JavaScript pass by reference and pass by value.

This post is about pass by value and pass by reference in JavaScript. there are primitive and non-primitive data types. objects are…