Frontend Masters Boost RSS Feed https://frontendmasters.com/blog Helping Your Journey to Senior Developer Fri, 12 Dec 2025 15:22:12 +0000 en-US hourly 1 https://wordpress.org/?v=6.9 225069128 Default parameters: your code just got smarter https://frontendmasters.com/blog/default-parameters-your-code-just-got-smarter/ https://frontendmasters.com/blog/default-parameters-your-code-just-got-smarter/#respond Fri, 12 Dec 2025 15:22:11 +0000 https://frontendmasters.com/blog/?p=8036 Matt Smith with wonderfully straightforward writing on why default parameters for functions are a good idea. I like the tip where you can still do it with an object-style param.

function createUser({ name = 'Anonymous', age = 24 } = {}) {
  console.log(`${name} is ${age} years old.`);
}

createUser(); // Anonymous is 24 years old.

]]>
https://frontendmasters.com/blog/default-parameters-your-code-just-got-smarter/feed/ 0 8036