Skip to content

Instantly share code, notes, and snippets.

@navanathjadhav
Created June 17, 2022 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navanathjadhav/a9fbb4dabe5a545b8ec412fe2a8e3cdf to your computer and use it in GitHub Desktop.
Save navanathjadhav/a9fbb4dabe5a545b8ec412fe2a8e3cdf to your computer and use it in GitHub Desktop.
Example of using stack memory efficiently
/*
* This will invoke showGreetMessage method and pass only required field
*/
function Greet() {
const greetObject = {
message: "Hello & Welcome to Ever Blogs",
alignment: "Top",
color: "black",
};
const { message } = greetObject;
showGreetMessage(message);
}
/*
* This method will be invoked and it takes message variable as argument
* Instead of taking whole greet object in argument, we take only message field
*/
function showGreetMessage(message) {
alert(message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment