Declaring a variable with a string parameter javascript -
When you declare a variable, I think the syntax will look like this:
Var test = "test";
This is a convertible declaration. I am confused about how this announcement actually works in my work:
Function Hello (test) {test = "Does this work?" Return test; } Hello what ');
I pass string logic to greet. In my eyes I am doing something like this inside the function:
"what" = "does it work?" Return "What"
In this case the identifier is a string identifier (in this case "what") the type has been changed, how is it ignoring that 'what' string is? Should not it be a syntax error?
You have to understand the difference between a variable and a value.
When you say hello ('what'), then you are assuming 'what' in the function. This value is assigned to the variable 'test' 'test' is a variable, which is one in memory The place is a reference in which the value is 'what', not just 'what'. Therefore, a new value in the variable test (i.e. 'does this work?') Is free to make free, which will store that value in memory in that place.
Comments
Post a Comment