Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1022 Bytes

introduction.md

File metadata and controls

34 lines (23 loc) · 1022 Bytes

Introduction.

  • We will see the introduction of it with some basic codes of js.
let num = 40;

num++; // it's called postfixed position increament. 40
console.log(num); // 41

++num; // it's called pre increment 42
console.log(num); // 42

Whenever We increment a num using postfixed position it will be return the value first, after that he will be increment the num.

Whenever we will use pre increment position for increment a num. it will increment num first, after that he will be return value.


here is a string which is representing a num;

Whenever we use num2 = num2 + 1 it will not increment a number it will be concat to that string.

Whenever we use postfixed position it will be increment to that string number but the main thing is it will change the data type of it string to number automatically.

let num2 = '5';
num2 = num2 + 1; //'51'


num2++ // 51
console.log(num2) // 52

For More Information Click Below:-

Introductions