Answer: Return type, Function keyword, Identifier and Parentheses
function printprops(o)
{
for(var p in o)
console.log(p + ": " + o[p] + "\n");
}
Answer: Returns undefined
Answer: When the function is defined as expressions
Answer: Stops executing the function and returns the value
Answer: It returns the undefined value
Answer: Procedures
Answer: return statement
Answer: function
Answer: o.m(x,y);
o.m(x,y);
Answer: o[“m”](x,y);
function info()
{
int a=1;
int b=2;
return a*b;
}
document.write(info());
Answer: 2
var arr = [7, 5, 9, 1]; var value = Math.max.apply(null, arr); document.writeln(value);
Answer: 9
var person =
{
name: “Rahul”,
getName: function()
{
nreturn this.name;
}
}
var unboundName = person.getName;
var boundName = unboundName.bind(person);
document.writeln(boundName());
Answer: Rahul
function code(id,name)
{
this.id = id;
this.name = name;
}
function pcode(id,name)
{
code.call(this,id,name);
}
document.writeln(new pcode(101,"vivek").id);
Answer: 101
var pow=new Function("num1","num2","return Math.pow(num1,num2)");
document.writeln(pow(2,3));
Answer: 8