25. Write a function that calculates the fibonacci value of a number
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39. function Counter(){ var count = 0; this.getValue = function(){ return count ;}; this.increase = function(){count ++;}; this.decrease = function(){count --;}; this.setValue = function(newVal){count = newVal;}; } var c = new Counter(); c.setValue(5); c.increase(); c.getValue(); // 6 c. count; // undefined public public public public private
40.
41. Write a function that receives an array of objects and sets their showIndex method to show their index in that array
45. What happens when things are too simple (the dark side of JavaScript)
46.
47.
48.
49.
50. with(obj){ a = b } if(obj.a === undefined){ if(obj.b === undefined){ a=b ;// two global variables } else { a = obj.b; // a is global, b is not } else { if(obj.b === undefined){ obj.a=b; // b is global , a not } else { obj.a = obj.b; // both not global } } The ‘with’ keyword obj.a = obj.b; // both not global obj.a = b; // b is global, a is not + a = obj.b; // a is global, b not a=b; // two global variables - + - a (exist in obj)