Introduction to JavaScript Flashcards

1
Q

What does client-side scripting mean?

A

Provides a way to dynamically modify the HTML content and appearance in the browser without having to contact the web server.

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

What is JavaScript?

A

A lightweight programming language that is used to make web pages more interactive.

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

How do you link a JavaScript file?

A

Using the tag and placing it in the head section of the HTML document.

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

What is event-driven programming?

A

Writing programs driven by user events. JavaScript programs wait for the browser or users action and respond to them.

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

What are the steps to make a responsive UI control?

A
  1. Choose the control (e.g. button) and event (e.g. mouse click) of interest
  2. Write a JavaScript function to run when the event occurs
  3. attach the function to the event on the control
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does alert(“…”) do?

A

A JS command that pops up a dialogue box with a message.

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

What is an event handler?

A

A routine that is used to deal with the event, allowing a programmer to write code that will be executed when the event occurs.

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

How do you write comments in JavaScript?

A

/* … */ and //

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

What are variables and how are they defined?

A

Variables are used to store and retrieve data. They are defined by using the keyword var.

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

What are the rules for variable names?

A
  1. The first letter must be a letter or an underscore with the rest being any letter, number, or underscore
  2. Variable names are case sensitive
  3. Words the are reserved by JavaScript cannot be used
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the different JS data types?

A

Number, string, boolean, array, objects, function

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

What are the different number types?

A

Whole numbers and numbers with decimal places (floats)

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

What is an expression?

A

The combination of one or more variables, values, operators, or functions that computes a result.

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

What does it mean when strings are treated like characters?

A

It means that each character is treated as a single vaule and not as a combination of characters.

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

What does .length do?

A

Returns the number of characters in the strings

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

What does string concatenation do? (+ operator)

A

Connects two string together

17
Q

How do you convert a number type to a string?

A

You can do this by using the + operator between variables that are a string and number, converting the number to a string.

18
Q

What is an array?

A

An array is a special cariable, which can hold more than one value at a time.

19
Q

What is an if statement?

A

An if statement ececutes code within the {} if the (condition) expression is true. if the expression is false, the statements within the {} are skipped.

20
Q

What is an if/else statement?

A

Almost the same as an if statement, but in this case, if the if statement (condition) expression is false, then the else condition is executed.