## Numbers

Types: In some programming languages like Java, C, or C++ there is the concept of types. For example, lets add 2 numbers using Java syntax.

``````int x = 3;
int y = 2;
int result = x + y;``````

As you can see we have to define what the type of the variables are. In this case our variables are of type int. There are other types to defining text, characters and so on.

In JavaScript land, we don't have to use types at all. Is a dynamic language like Python or Ruby. The same operation in JavaScript looks like this.

``````let x = 3;
let y = 2;
let result = x + y;``````

Numbers in JavaScript are represented in 64 bits. Therefore, we can have 264 different numbers (2 because bits are binary).

Fractional numbers are created like this;

``let fractionalNumber = 1.23;``

For exponentiation we can use this expression:

``let bigNumber = 2.54e4``

which is equal to 25400.

Arithmetic operations are what you would expect. Brackets have the higher precedence followed by multiplication and division and last addition and subtraction.

``````1 + 2 * (1 + 3) / 3

//is the same as

1 + 2 * (4) / 3

//is the same as

1 + 8 / 3

//is the same as

1 + 2.66667

//is the same as

3.66667``````

Another interesting operator in JavaScript is % which is the remainder of a division.

``````5 % 2
// 1``````

The result of this arithmetic operation is 1. In programming this is also called modulo.

## Special Numbers

JavaScript has `Infinity` and `-Infinity` as a special syntax to represent these values. However, as a best practise is recommended not to use them because they can quickly lead to the `NaN` value which means `Not a Number` in JavaScript's terms.

## Strings

Strings can be expressed using either:

``````// Backticks
`this is a string in Javascript`

// Single quotes
'this is a string in Javascript'

// Double quotes
"this is a string in Javascript"``````

Each way has its benefits and drawbacks at the same time. For example, when we have to write characters like double quotes in our sentence will be hard to do it using double quotes in our strings. One way to fix this is to use the escape character `\` before the "special" characters (e.g. double quotes).

Backticks can also be used with variables like this:

``````let x = 10;
console.log(`X is equal to \${x}`);
// X is equal to 10
``````

or like this:

``````console.log(`X is equal to \${1 + 1}`);
// X is equal to 2``````

In addition we can "add" strings. This is usually called string concatenation.

``````let word1 = "Hello";
let word2 = "world";
let sentence = word1 + " " + word2 + "!!!";
console.log(sentence);
// Hello world!!!``````

## Logical Operators

As in any other language we need to write logical operations. To do so we need logical and, or and equality.

In the JavaScript world we can use `&&` for logical and, `||` for logical or , `==` for comparing for equality, `!=` means not equal, `<` less than, `>` bigger than, `<=` less than or equal to, `>=` bigger than or qual to. Let's use them in some example below:

``````console.log(true && true);
//true

console.log(false && true);
//false

console.log(true || false);
//true

console.log(1 == 2);
//false

console.log(1 != 2);
//true``````

You can try this or more examples in your browser or by running scripts using Node.js. (I will show in a separate post how to install Node.js on your machine)

## Values

There are two interesting values in JavaScript, which are kind of the same thing and in most cases you can use them interchangeably. The values are `undefined` and `null` and they mean that they do not carry any meaningful value.