Types Menu

Author: Java-admin

Type And Javascript

Author: Java-admin

Javascript is ‘Dynamic Typing’ and you do not have to tell the engine what type of data a variable holds. It figures it out while the code is running. There’s no keyword telling JS what type of data type like most programming languages.

Read more

Primitive Types

Author: Java-admin

A Primitive Type is a type of data that represents a single value. They are values that is not an ‘Object’. An ‘Object’ is a collection of name/value pairs.

There are six primitive types in JS:

Read more

Operators

Author: Java-admin

Operators are special function that returns values and it is syntactically different. Operators take two parameters and return one result.

Read more

Operator Precedence And Associativity

Author: Java-admin

  • Operator Precedence – which operator functions gets called first. Functions are called in order of precedence (higher precedence wins).
  • Associativity – what order operator functions get called in from left-to-right or right-to-left when a function have the same precedence.

Read more

Coercion

Author: Java-admin

This is when JS converts a value from one type to another type. This happens often in JS because JS is dynamically typed. The ‘+’ does double duty.

var a = 1 + 2;

console.log(a); Read more

Comparison Operators

Author: Java-admin

The example below equals ‘True’ because 1 is less than 2 and 2 is less than 1, so the result is ‘True’.

console.log(1 > 2 > 3); < = true

Now, the below equation also result in a ‘True’. Now you are scratching your head and thinking how can this be a ‘True’.  Well, my friend because of coercion JS will convert your numbers into boolean. Read more

Existence And Booleans

Author: Java-admin

There’s a Boolean built in function that you can use to try to convert different values. Others have said that we should try not use these however they’re useful for demonstration purposes, so if I’m converting to a Boolean true or false in different values you can see what happens when you try to convert ‘undefined’. Read more

Default Value

Author: Java-admin

I want to talk about a special value called ‘undefined’ the JavaScript (JS) engine assigns to a variable.

Now, what if I called a function without a parameter unlike many programming languages JS doesn’t care and it will not throw an error it will simply pass nothing.

Read more