Week 5 Flashcards

1
Q

When JavaScript manipulates a page or responds to user actions, what is it called?

A

Event Handling

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

JavaScript can…

Dynamically update _______ (CKE)
Manipulate ____ and ___
Manipulate and validate ____

A

Content, HTML and CSS, Data

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

As a developer

JavaScript cannot…

A

Write data permanently to an existing file
Access files on the server
Get data from the server database
Handle file uploads

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

JavaScript was introduced by NetScape in ____
JavaScripts biggest update was in 2015 when ___ was released, the ___ version

A

1996, ES6, 6th

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

Is JavaScript interpreted or compiled?

A

Interpreted

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

JavaScript’s key construct is the ________

A

function

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

3 ways to add JavaScript to an HTML page. Which way is recommended?

A

Embed, Inline, Link

Link is recommended

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

T/F - To embed a script with JavaScript, just add the code as part of a script element

A

True

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

To link a JavaScript file, just like a CSS file, where does the link go?

A

In the HTML pages head

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

<!DOCTYPE html>

<html>
<head>



</head>
<body>
<button> Click Me! </button>
</body>
</html>

Will myFunction() link to the JavaScript function?

A

Yes

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

How do comments in JavaScript compare to Java?

A

They are identical

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

alert()

A

Display content with a pop up box

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

prompt()

A

DIsplays a message and an input field within a modal window

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

confirm()

A

Displays a question in a modal window with ok and cancel buttons

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

console.log

A

Display content in the browsers JavaScript console

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

document.write()

A

outputs the content (as markup or code) directly to the HTML document

17
Q

What does markup mean?

A

Markup is the series of characters, symbols, and language that organizes and defines how the content looks, It is the code.

18
Q

T/F - Each browsers console tab includes a text that you can use to enter your expressions or statements

A

True

19
Q

T/F - You can execute multiple statements in the console by separating each statement with a semicolon

A

True

20
Q

3 ways JavaScript code executes:

A
  1. Auto, when the page loads
  2. When your script calls a function
  3. In response to some event, such as the user clicking a button
21
Q

JavaScript variables are dynamically _____, declared with the ___ or ___ keyword and are ____ _________

A

typed, let or var keyword, case senstiive

22
Q

What does typeof do in JavaScript?

A

Figures out a given variables type

23
Q

What is the default value and type of a declared but uninitialized varaible?

A

Undefined and undefined.

24
Q

Do we use camelCasing for JavaScript?

A

yes

25
Q

T/F - In JavaScript, a variable can be declared after it has been used

A

True, it’s called hoisting

26
Q

Explain hoisting in JavaScript

A

It’s JS’s default behavior of moving declarataions to the top

27
Q

Explain the difference between “var” and “let” during these 3 scenarios

Scope

Re-declaration

Hoisting

A

Scope
* var declarations are function-scoped.
* let variables are block-scoped.
Re-declaration
* var variables can be updated and re-declared within the scope.
* let variables can be updated but not re-declared.
Hoisting
* var variables are hoisted with an initial value undefined.
* let variables are not hoisted with an initial value

28
Q

In JavaScript the “numbers” datatype represents ________ and ________-_____ numbers

A

integers and floating point

29
Q

An “object” in JavaScript includes ________ and ______

A

functions and arrays

30
Q

T/F - In JavaScript, strings can only be double quotes

A

False, they can be both double and single quotes

31
Q

What happens in each of these variable cases?
1. let a = “10”; let b = 20; console.log(a+b)
2. let a = “10”; let b = 20; console.log(+a+b)
3. let a = “10”; let b = 10; console.log(a-b)
4. let a = “10”; let b = true; console.log(a-b)
5. let a = “hello”; let b = “world”; console.log(a-b)

A
  1. 1020
  2. 30 - the 10 gets converted to a int the by unary operator (+)
  3. 0 (converted to int by the -)
  4. 9 (true = 1 when converted)
  5. NaN
32
Q

Name the string PROPERTY that can be used to see how long a string is

stringName.

A

stringName.length

33
Q

When using the Boolean() function, what are the values that will return false? what will return true?

A

False: 0, 0.0, NaN, empty string “”, null, and undefined
True: anything else

34
Q

JavaScript operators: +, -, /, *,… 3 more

A

% modulo division
++ increment
– decrement

35
Q

JavaScript Assignment Operators:
a += b
a *= b
a %= b
What do these do?

A

a = a+b
a = a*b
a = a%b

36
Q

T/F - else-if behaves the same way as if-else in Java

A

True

37
Q

All loops in JavaScript must consist of 3 things, what are they?

A

Incrementor
Conditional expression
Logic to increase the incrementor