M7 JavaScript Flashcards

(50 cards)

1
Q

Lightweight, cross-platform, single-threaded, and interpreted programming language for creating dynamic and interactive web content

A

JavaScript

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

JavaScript:
How does it function on the client side?

A

It runs on the user’s browser alongside HTML and CSS to enable user interaction

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

JavaScript: how does it function on the server side?

A

It functions by managing databases, file systems, and security

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

JavaScript: It enables a wide array of applications beyond the web. What are those?

A

Mobile app development
Game development
IoT
Real-time systems

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

It was sometimes dismissed as a “toy language” with limited capabilities

A

JavaScript

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

What you can build with JavaScript (examples)

A
  • Full-blown web or mobile apps
  • Real-time networking services (like chats and video streaming)
  • Command-line tools
  • games
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What browsers have that let it execute JavaScript code

A

JavaScript Engine

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

Examples of JavaScript engines

A

SpiderMonkey (firefox)
v8 (chrome)

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

A C++ program that has chrome’s JavaScript engine (v8) embedded in it. It lets you run JavaScript outside a browser; lets you build the backend for web and mobile applications

A

Node

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

The standard for JavaScript

A

ECMAScript

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

Official name of JavaScript

A

ECMAScript

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

JavaScript lives between __ tags

A

script

(

 and 
)

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

Old example of a tag containing JavaScript (inline)

A

<script type=”text/javascript”>

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

Where are scripts usually placed?

A

<head> and/or <body>
</body></head>

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

When scripts are put here, it runs before the page content loads. It might slow the rest of the page down

A

Scripts put in <head>

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

When script is put here, it runs as the page loads. It makes things snappier for users

A

Script in the <body>

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

Form of JavaScript that makes the code reusable and faster thanks to browser caching

A

External JavaScript

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

How do you reference external scripts

A
  1. Full URLs
    -
  2. Relative paths
  3. No path
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

There should be no script tags in JavaScript files

A

Ok

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

JavaScript’s ways of displaying data

A
  1. innerHTML()
  2. document.write()
  3. alert()
  4. console.log()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

A way JavaScript displays data wherein it finds an existing element by its ID and updates the content

22
Q

Syntax of innerHTML() when used with a button and getting element id.

In other words. What would be the syntax if u were to use a button to replace a paragraph?

A

<button></button>

[Button name]

</button>

This code says:
“When someone clicks this button, go find the HTML element whose id equals whatever is inside those brackets ([id]) and replace its inner HTML (that’s the content inside the element) with whatever’s in [new replacement].”

Remember. The innerHTML part is necessary so it actually replaces the contents of the id’d element. If we remove that, nothing will happen.

23
Q

A way of displaying data in Javascript that outputs it directly into the HTML document

A

document.write()

24
Q

What do you put in the parenthesis in document.write()?

A

The output you want to display in the document

Example:

<p> I love JS </p>

<script>
document.write('hello world')
</script>

Output:

I love JS

hello world
(note how it didn’t wipe out the entire html screen)

25
What has to be done in order to wipe out everything on the page when using document.write()?
If used after the page has loaded (It's fully loaded before a user clicks a button. Everything is then wiped out after the button is clicked)
26
Show the code using document.write() that wipes out the entire page, leaving the replacement (hello world), upon the click of a button
27
alert() syntax for if you want Hello World to appear as an alert window upon the click of a button
(Note: window is optional. You can just use alert() instead of window.alert())
28
A way of displaying data in Javascript that is considered the developers best friend
console.log()
29
console.log() example syntax
Note: it's like an implicit/secret narration of what the user does. It's logged in your console
30
Syntax for printing a page upon the click of a button
31
Referred to as step by step instructions for the computer to follow
JavaScript statements
32
They end each statement. Making it easier for the browser to understand where one instruction ends and the next begins
;
33
Why is spacing important in code?
It makes it readable
34
Groups of statements wrapped in curly brackets. They keep related statements together. Mostly used in functions
Code blocks
35
Ways to declare variables
var let const
36
In making variables, what do you call the values you provide in the script? The values that are fixed
Literals
37
Two of the many types of literals
Numbers Strings
38
Combination of values, variables, and operators that get evaluated
Expression
39
How do you make single line comments in JavaScript
//
40
How do you make multi line comments in Javascript
/* comment */
41
What do you call JavaScript names
Identifiers/variables
42
What do you call the casing in variables wherein the first word starts with a lowercase but the rest of the words start in uppercase?
Camel case
43
A way of declaring a variable for values that don't change
const
44
When do you use let and how often should you use const?
Let is used when you're calculating. Const is always used
45
Confines variables inside blocks
block scope
46
Variables declared this way dont respect the block scope
var
47
You can't redeclare a variable with let and a block scope
Ok
48
With this type of variable declaration, you can use a variable before it is declared?
var
49
With this type of variable declaration, you cannot use a variable before it is declared
let
50
When declaring a const variable, there must be a value already assigned: const x ❎ const x=5 ✅
Ok