Skip to content

Instantly share code, notes, and snippets.

@niktariy
Created September 22, 2019 15:24
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 niktariy/4b0b27a1afdf4a74c79fe6fad37f17e3 to your computer and use it in GitHub Desktop.
Save niktariy/4b0b27a1afdf4a74c79fe6fad37f17e3 to your computer and use it in GitHub Desktop.
Example of function with named parameters
function logParams (first, second, third) {
console.log(first, second, third);
}
// first => 'Hello'
// second => 'World'
// third => '!!!'
logParams('Hello', 'World', '!!!'); // "Hello" "World" "!!!"
// first => { o: 3 }
// second => [ 1, 2, 3 ]
// third => undefined
logParams({ o: 3 }, [ 1, 2, 3 ]); // {o: 3} [1, 2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment