1.1 What Is JavaScript Flashcards

1
Q

What Is JavaScript?

A

JavaScript (or simply JS) is the programming language of the web browser.

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

What is client-side programming?

A

the code runs on the client’s computer or device

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

What is server-side programming?

A

code is executed on a server and not on the user’s computer.

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

What does DOM stand for?

A

Document Object Model

The DOM, which stands for Document Object Model, is a programming interface for HTML.

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

What are functions?

A

functions are reusable pieces of code. Instead of writing the same code over and over again when you want to reuse it, you can put it inside a function and call the function where you need it.

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

What does the: alert() function do?

A

It’s predefined to open a pop-up in your browser.

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

()

A

Functions in JavaScript always have parentheses at the end, within which you can define custom parameters.

Click me!

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

onclick

A

onclick is a predefined HTML attribute.

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

Developer Tools Console

A

Option + Cmd + i

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

What happens:

alert(‘Hello world’);

A

pop-up with the text “Hello world”.

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

What happens:

console.log(‘Hello world’);

A

This function will print the given text to the console.

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

How do you clear the console screen?

A

“Cmd + L” or “Ctrl + L”.

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

Inline

A

“Inline JavaScript” means placing pieces of JavaSript directly into your HTML file, like this:

Click me!

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

Where should the tag go?

A

at the very bottom of the page, right before the closing body tag

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

Folder Structure:

A

simple-js-app:

css/
   styles.css
index.html
js/
   scripts.js
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you include script in your “index.html” page?

A

at the very bottom of the page, right before the closing body tag

17
Q

Comments in JS:

A

// - Single line comment

/* bla bla bla */

18
Q

Where should comments be placed?

A

before the piece of code they reference.

19
Q

What are Variables?

A

Variables are used to store—and later re-access—a piece of data, such as text or a number.

the value they store can be changed at any point in time.

var age = 29;
var name = 'Anne';
20
Q

console.log

A

Outputs to the console

21
Q

Names of Variables must:

A

It must start with a letter

It can only consist of letters, numbers, or underscores (“_”)

It can’t include any special characters, such as ü or à

Examples:

age
myAge
my_age
addressLine2

22
Q

Are Variables case sensitive?

A

Yes

Thus, myAge and myage would be two completely different variables. So would MY_AGE, and my_age.

23
Q
var josesAge = 35;
var lisasAge = josesAge;
A

you can assign one variable’s value to a second variable

24
Q
var myName = 'John Doe';
myName = 'John Doe Jr';
A

You can also assign a new value to an existing variable

when changing the value of a variable, you simply start with the variable name and don’t use var.

25
Q

document.write()

A

will write something on your document.

Example:

var myName = 'Bob';
document.write(myName);
26
Q

True or False

every command in JavaScript must end with a semicolon: ;

A

True

27
Q

Is this correct? Why or why not?

document.write(myName);
var myName = 'Bob';
A

code is always executed top to bottom, line by line. Above, the contents of the variable myName in document before the browser even understood what myName stands for

28
Q

var

A

Variable

28
Q

Mathematical expressions?

A

+, -, *, /

var simpleAddition = 2 + 2;
document.write(simpleAddition);