primitive and non primitive data types in javascript
//primitive = {STRING, NUMBER, BOOLEAN, SYMBBOL, UNDEFIEND, NULL}
//non-primitive = {ARRAY, OBJECT, FUNCTION}
//primitive is always copied by VALUE
var a = 1;
var b = a;
//console.log(a , b) = 1 , 1
a = 3;
console.log(a) //3
console.log(b) // still 1 and not 3 (always copied by value only)
//non-primitive is always copied by REFERENCE
var x = {name : "Jscript"};
var y = x;
//console.log(x , y) TWICE = Object { name: "Jscript" }
x.name = "Js";
console.log(x) //Js
console.log(y) //Js {copied by reference} like pointers in C lang
Also in JavaScript:
- PayloadTooLargeError: request entity too large using express json middleware
- jquery get data attribute value
- index and id together angularjs
- javascript array to comma separated list
- react js http post 500 internal server error
- javascript decimal to string
- manage favicon with express app
- js split last occurence
- react hook usestate
- cannot create an instance of an abstract class httphandler angular
- set variable with json javascript
- how to access the second class of an element javascript
- make indexOF in js
- learn vue js
- javascript queryselector
- mysql json array contains
- most popular company with nodejs
- python serialization json marshmallow
- react check if string is mail
- how to get the computer date and time jquery
- get current time epoch javascript
- how to push string into array in javascript
- in in sequelize
- enzyme at example