Here are more questions I’ve made up to help people at my company prepare for the Microsoft certification exam 70-480, Programing in HTML5 with JavaScript and CSS3. These focus on Module 7 of the curriculum.
In strict mode, what will print on the Chrome console with the following code?
(function() {
console.log(a);
var a='Hello!';
})();
In strict mode, what will print on the Chrome console with the following code?
(function() {
console.log(f());
var f = function() { return 'Hello!'; }
})();
How could you make a function part of a namespace?
What will this code print on the Chrome console? console.log(Math.parseInt('123'))
Which CSS instructions will cause text to break only on word boundaries?
What differences will there be between objects a
and b
after var a = new Object(); var b = { };
?
What will print on the console?
var a={
counter: 111,
printCounter: function() { console.log(this.counter); }
};
var b = {
counter: 222
};
b.printCounter = a.printCounter;
b.printCounter();
Which of the following are true when you create an object with the new
keyword?
What will be printed on the Chrome console after the following code?
var MyConstructor = function() {
this.a = 123;
};
var first = new MyConstructor();
MyConstructor.prototype.protofunc = function() { console.log(this.a); }
var second = new MyConstructor();
second.protofunc();
You have the following constructor function and a function on its prototype. What will be true of the haveBirthday
function?
var Person = function() {
var age;
/* more code */
}
Person.prototype = {
haveBirthday: function() { /* more code */ }
};