Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. // 1. What is the outcome of the two alerts below?
  2. var foo = "Hello";
  3. (function() {
  4.   var bar = " World";
  5.   alert(foo + bar);  // “Alert #1"
  6. })();
  7. alert(foo + bar);   // “Alert #2"
  8.  
  9. //==========================================
  10.  
  11. //2. What is the difference between A and B:
  12. function Person() {
  13.   this.firstname = “John”;
  14.   this.lastname = “Doe”;
  15. };
  16. var person = Person(); // “Situation #1"
  17. var person = new Person(); // “Situation #2"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement