Web Programming - Week 2 Flashcards

1
Q

Advantages of JavaScript

A

Speed
Rich Interfaces
Increased Interactivity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to embed JavaScript

A

The HTML < script > tag in < head > or < body >

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Generating Output

A

innerHTML

window. alert()
document. write()
console. log()
window. print()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Inputting a value

A

var name = window.prompt()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Declaring variables

A

var
let
const

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Comment syntax

A
// - Single line
/* *\ - Multi line
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Return datatype of value

A

typeof variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Types of variable scopes

A

Global - Anywhere
Function - Only within function
Block - Only inside block with let keyword

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Arithmetic Operators

A

% Modulus
++ Increment
– Decrement

+= Adds to original value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Relational Operators

A
=== equal value and equal type
!== not equal value or equal type
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Logical Operators

A

&& and
|| or
! not

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Conditional Statements

A
if (condition) {}
else if (condition) {}
else {}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

JavaScript Switch

A

switch (expression) {
case value1:
default:
}

If value1 = expression, then case
If no case applied, then default

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Conditional Ternary Operator

A

condition ? exprIfTrue: exprIfFalse

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Loops and Iteration

A
for ([inital]; [condition]; [expression]) {}
for...in
for...of
while (condition) {}
do...while
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Loop statements

A

Break jumps out of the loop

Continue jumps to the next loop iteration

17
Q

Function syntax

A

function name(parameter1, parameter2, etc..){}

18
Q

What does \ do

A

Turns special characters into string characters

19
Q

How to make a function return a value

A

return value;

20
Q

How to refer to an element

A

document.GetElementById(“ElementID”)