javascript Flashcards

1
Q

What is the advantage of external JavaScript?

A

Separates HTML and Code
Makes HTML and JavaScript easier to read and maintaiin
Cached JS files can speed up page loads

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

Name the four ways of JavaScript Display Possibilites :

A

console.log() -browser console
window.alert() -alert box
document.write() -html element
innerHTML

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

Write the code to change the id element named “demo” when the user clicks on a button.

A

<p>This will be changed</p>

Click

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

<h1>My First Web Page</h1>

<p>My First Paragraph.</p>

<p></p>

Insert the sum of 5+5 inside the p tag.

A
var a =document.getElementById("demo");
a.innerHTML = 5+5;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The JavaScript programs are executed by what?

A

the web browsers

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

Can you name the javascript statements?

A
C : comment
O : operators
V : values
E : expressions
K : keywords
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the two types of JavaScript Values?

A

Fixed values and variable values.
fixed values : literals
variable values : variables

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

Name the ways you can declare variables

A

var, let and const

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

Difference between let and var?

A

var : known through out the function it is defined in

let : known thoughout the block it is defined in

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

Is JavaScript case sensitive?

A

Yes

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

What character set does javascript use?

A

Unicode

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

How do you debug in javascript?

A

All moderns browsers have a build in javascript debugger.

F12 and console

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

Name the 7 Javascript types.

A
Number
String
Boolean
function
Object
Null
Undefined
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to create a javascript object?

A

var person ={firstname: “John”,

lastname: “Doe”,
age: 50};

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

What is the typeof undefined?

A

undefined

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

What is the datatype of null?

A

object

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

what is null=== undefined?

A

false

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

What is null==undefined?

A

true

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

can u declare string as objects?

A

NOPE DONT DO IT

20
Q

Create an object.

A
Var person =
{
 name : 'nilima',
great : 'very great'
};
21
Q

What are the scopes in javascript?

A

local and global

22
Q

What is a scope?

A

the set of variables, objects and functions you have access to.

23
Q

What are the event listeners?

A

<div></div>

element. onclick=function(){}
element. addEventListener(“click”, function(){});

24
Q

What does event.stopPropogation()?

A

it will stop calling event handlers.

25
What does event.target do?
Always points to the lowest element on the tree it was clicked.
26
What is bubble?
bubble starts at the bottom of the tree and works its way up
27
What is capture/
starts at the top and goes to the button
28
Name the string method to uppercase?
toUpperCase();
29
Name the string method to lowercase?
toLowerCase()
30
What returns the Maximum value?
MAX_VALUE
31
What returns the Minimum value?
MIN_VALUE
32
What does Math.pow() do?
Math.pow(2,2) | 2 to the power 2 = 4
33
What does Math.sqrt() do?
square root of
34
What does Math.ceil do? Math.ceil(4.7)
5
35
What does Math.floor do? Math.floor(4.7)
4
36
What doe Math.random() return?
from 0 - 1 any number decimals
37
How to sort array?
array.sort();
38
How to reverse array?
array.reverse();
39
How to handle errors?
like java try catch
40
What is an error?
An object that has two properties named name and message.
41
Name error name values
6 different values - EvalError - RangeError - ReferenceError - SyntaxError - TypeError - URIError
42
what is ajax?
Asynchronous JavaScript and XML. The ability to send request from JS asynchronously u send the request forget about it and when you get the response you handle it
43
Name the four steps in AJAX
- create object - define onreadystatechange function - open request (method, url, async) - send request
44
What does JQUERY have?
a single global object | $ and jQuery
45
How to write ajax in jquery?
``` $.ajax({method: "get", url:"some url", success : function(){}, error : " ", complete : "" }) ```