Javascript Flashcards

1
Q

Outline the differences between client-side scripting and server-side scripting.

A

Client Side:
-HTML, CSS, Javascript used
-Source code visible to User
-No security for data
-Main function to provide the requested output.
-Depends on browser and verison
-Runs on user’s computer

Server-Side Scripting
-PHP, Python, Javascript etc.
-Source code invisible
-More security
-Main function to provide access to database as per request.
-Does not depend on the browser
-Runs on the web server

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

Who designed Javascript? Working for who? When? How long did it take?

A

Brendan Eich
Netscape
1995
10 days

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

When did Javascript become an ECMA standard?

A

1997

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

What does ECMA stand for?

A

European Computer Manufacturers Association.

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

Outline the key differences between JAVA and javascript.

A

JAVA:
compiled
back-end
Strong security
C++ syntax
Requires JAVA development kit
For various apps

Javascript:
Interpreted
Front-end
Weak security
C syntax
Written in any text editor
Mainly for web apps

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

What are the three approaches for adding Javascript to a HTML file?

A

External .js file
Internal between

 tag
Inline javascript handles directly within HTML
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the pros and cons of internal javascript?

A

Pros: Fast to implement
Easy to Read Code

Cons:
Makes it hard to reuse code.
Slows Performance.

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

What are the pros and cons of inline javascript?

A

Pros: Quick to implement
Perfect for a small app

Cons: The code is not reusable.
Slows performance
Code readability concerns

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

What function is used to select HTML elements by id?

A

getElementById((“id”)

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

What function adds an element to the end of an array and what function adds an element to the start of the array?

A

push(element to be added)
unshift(element to be added)

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

What function removes (a) the last element of an array and (b) the first element of an array and returns that element?

A

pop()
shift()

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

When are backticks used in javascript?

A

When you want to include a variable value in the print statement of a string.

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

Equality and non-equality symbols for javascript.

A

Equality: ===
Non-equality: !==

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

Syntax for an arrow function.

A

let function_name = (argument1, argument2,..) => expression

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

What is an event in javascript?

A

Events are things that happen in the system you are programming, which the system tells you about so your code can react to them.

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

What are event handlers?

A

Run when an event fires allowing web pages to respond appropriately to change.

17
Q

What must be done if Javascript is loaded and parsed before HTML but we want to alter HTML? 2 solutions.

A

document.addEventListener(“DOMContentLoaded”, function(event){
//add further javascript
});


18
Q

How is local vs global scope define in javascript?

A

Local scope is inside {}

19
Q

What is the TDZ in javascript?

A

Temporal Dead Zone
Is a phase in the execution of JavaScript code when a variable is in a state of “limbo”. During this phase, the variable exists, but you cannot access its value.

20
Q

What does NaN stand for? What is it?

A

Not a Number
Represent an undefined or unrepresentable result of a mathematical operation.

21
Q

What is an API?

A

Application Programming Interfaces are ready-made sets of code building blocks that allow a developer to implement programs that would otherwise be harder to implement.