"34", true, false - ANS-javascript: what are the results of the following statements?
3 + "4"
3 == "3"
3 === "3"
"make" in myCar - ANS-javascript: var myCar = {make: "Ford",
year: 2006, state: "OH"}
write a statement to check of the property make exists in myCar
"NKR4621996", 2340 - ANS-javascript:
function report() {
return this.plate + this.year;
}
myCar = {plate: "NKR462", year: 1996};
yourCar = {plate: 340, year: 2000};
myCar.register = report;
yourCar.info = report;
myCar.register();
yourCar.info();
what is the output of myCar.regiter() and yourCar.info()?
25 - ANS-javascript: what is the result of the last function call?
function apply(x, a) {
return x(a);
}
function square(i) {
return i*i;
}
apply(square, 5)
document.writeln("<ol><li>");
document.writeln(
roster.filter(function (e, i, a) {
return e.gpa > 3.0;
}).sort(function (a, b) {
return b.midterm - a.midterm;
}).map(function (e, i, a) {
return e.name + " ("
+ e.midterm + ")";
, }).join("</li><li>"));
document.writeln("</li></ol>"); - ANS-Given: roster of students (an array)
var roster =
[ { name: "Mary Smith",
gpa: 3.7,
midterm: 80 },
{ name: "Xi Chen",
gpa: 3.5,
midterm: 85 },
{ name: "Alessandro Reis",
gpa: 3.2,
midterm: 74 },
{ name: "Erin Senda",
gpa: 3.0,
midterm: 68 } ];
Write a JavaScript program that outputs
an html list of students (name and
midterm score) whose gpa is > 3.0, such
that the list is sorted by midterm score
1.Xi Chen (85)
2.Mary Smith (80)
3.Alessandro Reis (74)
Dr. Turing - ANS-javascript: what does prof() return?
function grantDegree(a) {
var prefix = "Dr. ";
function add() {
return prefix + a;
}
return add;
}
var prof = grantDegree("Turing");
prof()
f is ["beluga", "blue", "killer"]
n is [300, 5, 90] - ANS-javascript: what is n and f?
var n = [5, 300, 90];
var f = ["blue", "beluga","killer"];
n.sort();
f.sort();
false - ANS-javascript: