"1" + 2 + "3" + 4;
What does the above statement evaluate to?
- 10
- 1234
- 37
JS Quiz Exercise Lab
What is Javascript?
JavaScript is the scripting language of the Web.JavaScript is used in millions of Web pages to add functionality, validate forms, detect browsers, and much more.
What Javascript can do?
What is a Javascript statement?
What is the difference between XML and HTML?
What is a javascript object?
Describe what event bubbling is?
Describe what "this" is in JavaScript?
What is the difference between == and === ?
Where do you place your JavaScript on the page?
What is a closure?
What is Global Namespacing?
"1" + 2 + "3" + 4;
What does the above statement evaluate to?
1234
4 + 3 + 2 + "1"
What does the above statement evaluate to?
91
var foo = 1; function bar() { foo = 10; return; function foo() {} } bar(); alert(foo);
What is alerted?
1
function bar() { return foo; foo = 10; function foo() {} var foo = 11; } alert(typeof bar());
What is alerted?
Function
var x = 3; var foo = { x: 2, baz: { x: 1, bar: function() { return this.x; } } } var go = foo.baz.bar; alert(go()); alert(foo.baz.bar());
What is the order of values alerted?
3, 1
var x = 4, obj = { x: 3, bar: function() { var x = 2; setTimeout(function() { var x = 1; alert(this.x); }, 1000); } }; obj.bar();
What value is alerted?
4
x = 1; function bar() { this.x = 2; return x; } var foo = new bar(); alert(foo.x);
What value is alerted?
2
function foo(a) { alert(arguments.length); } foo(1, 2, 3);
What value is alerted?
3
var foo = function bar() {}; alert(typeof bar);
What value is alerted?
undefined
var arr = []; arr[0] = 'a'; arr[1] = 'b'; arr.foo = 'c'; alert(arr.length);
What value is alerted?
2
function foo(a) { arguments[0] = 2; alert(a); } foo(1);
What value is alerted?
2
function foo(){} delete foo.length; alert(typeof foo.length);
What value is alerted?
Number
var foo = function foo() { console.log(foo === foo); }; foo();
What is printed in the console?
true
function aaa() { return { test: 1 }; } alert(typeof aaa());
What does the above alert?
undefined
Number("1") - 1 == 0;
What is the result?
true
(true + false) > 2 + true;
What is the result?
false
function bar() { return foo; foo = 10; function foo() {} var foo = '11'; } alert(typeof bar());
What is alerted?
function
"1" - - "1";
What is the result?
2
var x = 3; var foo = { x: 2, baz: { x: 1, bar: function() { return this.x; } } } var go = foo.baz.bar; alert(go()); alert(foo.baz.bar());
What is the order of values alerted?
3, 1
new String("This is a string") instanceof String;
What is the result?
true
[] + [] + 'foo'.split('');
What is the result?
"f, o, o"
new Array(5).toString();
What is the result?
",,,,"
var myArr = ['foo', 'bar', 'baz']; myArr.length = 0; myArr.push('bin'); console.log(myArr);
What is printed in the console?
['bin']
String('Hello') === 'Hello';
What is the result?
true
var x = 0; function foo() { x++; this.x = x; return foo; } var bar = new new foo; console.log(bar.x);
What is printed on the console?
undefined
"This is a string" instanceof String;
What is the result?
false
var bar = 1, foo = {}; foo: { bar: 2; baz: ++bar; }; foo.baz + foo.bar + bar;
What is the result?
NaN
var myArr = ['foo', 'bar', 'baz']; myArr[2]; console.log('2' in myArr);
What is the result of console.log?
true
var arr = []; arr[0] = 'a'; arr[1] = 'b'; arr.foo = 'c'; alert(arr.length);
What value is alerted?
2
10 > 9 > 8 === true;
What is the result?
false
function foo(a, b) { arguments[1] = 2; alert(b); } foo(1);
What value is alerted?
undefined
NaN === NaN;
What is the result?
false
What type of object system does JavaScript support?