const name = "strawberrycream"
const age = 22
const gender = "female"
const sayHi = (name, age, gender) => {
console.log(`Hello ${name}, you are ${age} and you are a ${gender}`)
}
sayHi(name, age, gender)
const name = "strawberrycream"
const age = 22
const gender = "female"
const sayHi = (name, age, gender) => {
console.log(`Hello ${name}, you are ${age} and you are a ${gender}`)
}
// sayHi 함수는 3개의 인자를 받고 있기 때문에 오류가 생긴다.
sayHi(name, age)
gender
끝에 ?
를 추가해서 해결할 수 있다.
const sayHi = (name, age, gender?) => {
...
}