Javascript Pains

Hello! I’m just rejoining the Full Stack Path after an extended break. I’m struggling with Javascript, which is where I left off last time. (PLEASE HELP?) Specifically, my present concern is that I don’t understand why this function is formatted the way it is in the solution.

const icanhaz = (arg='cheezburger') => {

return `i can haz ${arg}?`

}

// Returns: i can haz presentz?

console.log(icanhaz('presentz'));

// Returns: i can haz cheezburger?

console.log(icanhaz());

In particular, I’ve never seen this formatting in a function parameter:

const icanhaz = (arg='cheezburger') =>

Mind you, I haven’t been going through the Javascript section lesson-by-lesson (since I had completed the Syntax I part of the course before). But I have never seen |arg=‘argument’| as a parameter. I have been refreshing myself on everything Javascript, and I’m still lost.

That is an arrow function with a default parameter.

2 Likes

Thank you for your help. Now that I know that default parameters exist . . . not such an issue lol

1 Like