Javascript data types

Solve your problems or get new ideas with basic brainstorming

Get Started. It's Free
or sign up with your email address
Rocket clouds
Javascript data types by Mind Map: Javascript data types

1. Number

1.1. Avoid using new Number() to declare a variable.

1.2. Javascript not has type number( int, double, float, tinyint, ... )

1.3. Infinity

1.4. IsNaN() : is not a number???

1.5. toString() : convert number to string

1.6. toExponential() : convert number to exponential number

1.7. toFixed() : convert corectly number decimal

1.8. toPrecision() : convert number decimal with length

1.9. Operator + String variable ~ convert string to number

1.10. Math

1.10.1. round() : decimal number to nearly interger number

1.10.2. ceil() : up decimal number to nearly interger number

1.10.3. floor() : down decimal number to nearly interger number

2. String

2.1. Avoid using new String() to declare a variable.

2.2. charCodeAt() : return a unicode character

2.3. charAt() : return a value

2.4. Regular Expression

2.4.1. search()

2.4.1.1. return Position

2.4.2. replace()

2.4.2.1. return new String replaced

2.4.3. test()

2.4.3.1. return True / False

2.4.4. match()

2.4.4.1. return Array of string is match

2.4.5. exec()

2.4.5.1. return a string is found

3. Array - Special type of Object

3.1. Not supported for named indexed ex: arr = new Array(); arr['name'] = "Abc"; arr['sex'] = "male"; ---> arr.length not support, ...

3.2. Avoid used to new Array(), should using []

3.3. valueOf() & toString is same : convert value of array to String

3.4. join( separator ) : join value or array to string with separator

3.5. pop() : remove the last element of array -> return "poped out"

3.6. push() : add new element at the end of array -> return new array

3.7. shift() : remove the first element of array

3.8. unshift() : add the new element at the first of array -> return new array length

3.9. delete(indexed) : delete element at position in array and set value is undefined

3.10. splice( positionAdded, totalElementReplace, [newElementAdded,...] )

3.11. sort() & reverse() : sort method cannot used to sort number array. sort( function(a,b){ return a - b; } ) : order number array - [b - a] will order with DESC

3.12. concat([array,...])

3.13. slice([position,...]) : slice element with position from array and return new array

4. Object everything in javascript is Object

5. Boolean

5.1. Avoid using new Boolean() to declare a variable.

5.2. A real value is TRUE (number, string, ...) Without a real value is FALSE (undefined, NaN, 0, '',...)

6. Null

7. undefined

8. Date

8.1. Date() : string date time

8.2. new Date(year, month, day, hour, minute, second, milisecond) : Note - month count from 0 to 11

8.2.1. toString() : convert Date object to String

8.2.2. toUTCString()

8.2.3. toDateString()

8.2.4. set / getDate() : set / get day of month - from 0 to 31

8.2.5. set / getDay() : set / get day of week - from 0 to 6

8.2.6. set / getMonth() : set / get month - from 0 to 11

8.2.7. set / getFullYear() : set / get year xxxx Optional arguments : yyyy , mm, dd

8.2.8. set / getHour()

8.2.9. set / getMinute()

8.2.10. set / getSecond()

8.2.11. set / getTime() : return number time milisecond from 1/1/1970

8.3. Date.parse() : parse string to Date object new Date( Date.parse() )

8.4. Compare two Date with Date Object

9. Function

9.1. Function declarations

9.2. Function expression