Thursday 14 February 2013

Tuesday 12 February 2013

JavaScript - Predict the Output - Question 3


"use strict";

var employee = {
    name: 'Amnal'
};

Object.defineProperty(employee, 'age', {
    value: 28,
});

for(var x in employee)
{
    console.log(employee[x]);
}

"use strict";
var employee = {
    name: 'Amnal'
};

Object.defineProperty(employee, 'age', {
    value: 28,
});

for(var x in employee)
{
    console.log(employee[x]);
}

Monday 4 February 2013

JavaScript - Predict the Output - Question 2


Object.defineProperty(this, "MAX_SIZE", {
  value: 100
});

alert("OLD VALUE "+ MAX_SIZE); 

MAX_SIZE = 200; 

alert("NEW VALUE "+MAX_SIZE);

What would be the output & why?