///////////////stack and heap memory in js//////////////////// //// STACK MEMORY(PRIMITIVE USED ) let myYotubename ="hitensh" let anothername = myYotubename //value assinged anothername="chaiorcode"//value updates /// copy is returning console.log(myYotubename);//hitensh console.log(anothername);//chaiorcode //////// HEAP (NON PRIMITIVE USED) let UserOne = { email: "oldgmail.com", upi: "user@ybl" } let UserTwo = UserOne UserTwo.email ="new22gmail.com" console.log(UserOne.email); /// new22gmail.com console.log(UserTwo.email);/// new22gmail.com
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter