Do we need to declare and initialize the parameters before it is used in a function?

I get the same output with both the codes with or without the string declaration with the function call
console.log(sillySentence(‘excited’, ‘love’, ‘functions’))
Screen Shot 2020-09-18 at 10.19.18 PM

image

No, you don’t have to, and in fact it doesn’t do anything. The stringOne parameter has a function scope, but the variable stringOne has a global scope. That means they actually point to two different memory points.

3 Likes