I want to set variable 'testValue' to 3 using a Self Invoking Function, can you help me?
var testValue;
function test() { testValue = 3; }();
What is the result of executing the previous code?
SyntaxError: Unexpected token )__match_answer_and_solution__What is the value of variable 'testValue'?
undefined__match_answer_and_solution__Why?
The value of testValue is undefined because the function has not been autoexecuted.__match_answer_and_solution__Write the code to execute this function adding only one more character to the sentence.
var testValue;
function test() { testValue = 3; }();var testValue;
!function test() { testValue = 3; }();assert(testValue == 3);