JavaScript Data Types

 
1. What is a String Data Type in JavaScript?

A string is a variable which stores a series of characters.

 
2. Give 3 examples of data considered as String.

EX:

var carname=”lala”;
var bakery=’macaron’;
var taste=’sweet’;

 
3. What is an Integer Data Type?

Variable which stores whole numbers

 
4. Give 3 examples of data considered as Integer.

16 & 20 & 31

 

 
5. What is a Floating-point value?

A real number (that is, a number that can contain a fractional part). The following are floating-point numbers

 

 
6. Give 3 examples of data considered as Floating-point numbers.

3.0

-111.5

½

 
7. What are the two values considered as Boolean Data Type?

True & False

 

 
8. What are the Composite Data Types?

Object & Array

 

 
9. What are the Special Data types in JavaScript?

Null & Undefined

 

Sources:

http://www.w3schools.com/js/js_datatypes.asp

http://msdn.microsoft.com/en-us/library/ie/7wkd9z69%28v=vs.94%29.aspx

http://oreilly.com/javascript/excerpts/learning-javascript/javascript-datatypes-variables.html

http://www.webopedia.com/TERM/F/floating_point_number.html

 

Advertisements

Intro to JavaScript

 

1. What is JavaScript?
A scripting language developed by Netscape to enable Web authors to design interactive sites.

2. What company started JavaScript?
Netscape.

3. Explain briefly the main difference of Java and JavaScript.
Java is for programming(For programs and browser) but JavaScript is for scripting (For browser only)

4. What are the things can we do to a webpage using JavaScript?
Makes our webpage interactive
5. Where do we write JavaScript codes? On which programs/applications?
We put it in html document
6. How can we see the result of our JavaScript code?

View in the browser

 

7. What is the HTML tag to start a JavaScript code?
<script> </script>
8. What is a variable? How is it different to a value?
Variable is buckets of data, a way of creating a reference to that data and it holds value.
9. What are the data types in JavaScript?
String, Number, Boolean, Object, Array, Null, Undefined
10. How do we write comments in JavaScript?
//TEXT HERE