Javascript Flashcards

1
Q

Javascript supports what type of style?

A

object-oriented, functional, and event driven

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

How is JavaScript executed client-side?

A

Each browser has a JavaScript engine that || !interprets! || the code

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

Internal definition

A

-JS in HTML file
-Imbedded in script tags
-In head or body
-Executed once parsed

 window.alert("Test");
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

External definition

A
  • Script in a .js file
  • Script tags
  • In header or body
  • Executed once parsed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Javascript types

A
Primitive:
-number
-string
-boolean
-undefined
Complex
-object (inc arrays)
-function

type can be checked with typeof(var);

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

What does JSON stand for?

A

JavaScript Object Notation

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

Conversion between JSON and JavaScript

A

var obj = {name: “Grischa”, age: 31}; //Object

var json = JSON.stringify(obj); //JSON

var json = ‘{“name”: “Grischa”, “age”: “31”}’; //JSON String

var obj = JSON.parse(json); //Object

JSON.stringify() removes functions

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

Parts of the bad rep of JS covered in VEFF1

A

Type conversion
Comparators
Scope
Hoisting

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

JS type conversion

A

Types are dynamic

Type conversion is from left to right.

var m = 5 + 6 + '5';
m = '115'
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

JS Comparison

A

== compares the value, so it does type conversion (!=)

=== compares both the type and value (!==)

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

JS Scopes

A

Global, local, and block scope

global/local scope
var x = 'bla'
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

JS Hoisting

A

JS “hoists” (moves) variable declarations to the top of the scope

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

JS Calback

A

Used to execute functionality after work is done.

Callback function is provided as a function parameter

Callback function is caled when main function is finished.

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

Why use Callback functions

A

Good tool to use when dealing with the internet, you fx dont know how long an HTTP response takes. No need to check for results. You can continue doing stuff while you wait for the callback function!

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

AJAX (Asynchronous JavaScript And XML) why and what?

A

BTW it allows more than just XML, inc JSON.

Allows HTTP requests and responses after the page has been loaded.

Update the page without reload

Load only what is needed

Load different data depending on user actions

Use the standard XMLHttpRequest object to make requests.

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

Axios: why and what?

A

JS library used to symplify HTTP requests