MCQs > IT & Programming > JavaScript > Assuming that each code is called with: 'var say = sayHello('Mary Jane');', which one is a closure?

JavaScript MCQs

Assuming that each code is called with: "var say = sayHello("Mary Jane");", which of the following is a closure?

Answer

Correct Answer: function sayHello(name) { var text = 'Hello ' + name; var sayAlert = function() { alert(text); } return sayAlert; }

Explanation:

Note: This Question is unanswered, help us to find answer for this one

JavaScript Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

JavaScript Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it