50 javascript interview questions

Solutions on MaxInterview for 50 javascript interview questions by the best coders in the world

showing results for - "50 javascript interview questions"
Richie
16 Sep 2016
1var someObject = {
2myProperty : 'Foo',
3
4myMethod : function(prefix, postfix) {
5
6    alert(prefix + this.myProperty + postfix);
7}
8};
9someObject.myMethod('<', '>'); // alerts '<Foo>'
10var someOtherObject  = {
11
12    myProperty : 'Bar.'
13
14};
15someObject.myMethod.call(someOtherObject, '<', '>'); // alerts '<Bar>'
16
17someObject.myMethod.apply(someOtherObject, ['<', '>']); // alerts '<Bar>'
18