Javascript, DOM and AJAX Flashcards

1
Q

What is the format of the HTML script tag?

A

< script type=”text/javascript” >
// Code here
< /script >
Technically, type attribute is optional in HTML5.
Very old browsers might need the code inside the script tag commented out with < !– and – >

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

What is the noscript tag?

A

Inverse of the script tag. Content shows when JS is not available. It is deprecated and not necessary if you create JS that is unobtrusive.

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

Easiest way to prompt and alert user.

A

With
var name = prompt(“Enter your name”, “”);
and
alert(“Hello, “ + name);

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

How to return the type of a variable?

A

typeof() returns type of data passed to it.

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

How to convert a float to an integer?

A

parseInt()

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

How to explicitly convert string to a number?

A

Number() or parseFloat() or parseInt()

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

How to explicitly create a string object?

A

var myStr = new String(“abc”);

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