How to define a function with default parameter in JavaScript

Syntax
Last updated Dec 18, 2017
function greetUser(name = "user") {
  return `Welcome ${name} to code to go!`;
}

let result = greetUser();

console.log(result);
Welcome user to code to go!