Ask Question

After the following code runs, what will be the value of result? var x = 30; function get () { return x; } function set (value) { x = value; } set (10); var result = get (20);

+3
Answers (1)
  1. 15 December, 05:38
    0
    Null

    Explanation:

    It entirely depends on the language you are using to implement this.

    But generally by the rule of scope, "result" will return null since get () was not defined to accept any argument, and it neither know the global "x" not defined it's own x in the function.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “After the following code runs, what will be the value of result? var x = 30; function get () { return x; } function set (value) { x = ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers