So Variable c inside the function addNumbrr code block cannot be called again outside the function code block? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

So Variable c inside the function addNumbrr code block cannot be called again outside the function code block?

function addNumbers(a, b) { var c = a+b; return c; } document.write( addNumbers(40, 2) );

20th Aug 2017, 1:42 PM
Vallery De Lexy
Vallery De Lexy - avatar
1 Answer
+ 4
yes you cannot ! var c was declared & tied to the function's scope(addNumbers in this case) and can be called only in that function, Note: always try before searching, always try before asking. https://code.sololearn.com/WSCw1DM58IDD/?ref=app
20th Aug 2017, 1:57 PM
Lord Krishna
Lord Krishna - avatar