<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>parameters on Curtis Timson</title><link>https://hugo.curtiscode.dev/tags/parameters/</link><description>Recent content in parameters on Curtis Timson</description><generator>Hugo -- gohugo.io</generator><language>en-GB</language><lastBuildDate>Wed, 05 Oct 2016 00:00:00 +0000</lastBuildDate><atom:link href="https://hugo.curtiscode.dev/tags/parameters/index.xml" rel="self" type="application/rss+xml"/><item><title>Default parameters with ES6</title><link>https://hugo.curtiscode.dev/post/js/default-parameters-es6/</link><pubDate>Wed, 05 Oct 2016 00:00:00 +0000</pubDate><guid>https://hugo.curtiscode.dev/post/js/default-parameters-es6/</guid><description>With ES5 if you wish to set default parameters on a javascript function you would be required to check the value and supply a default if one hadn&amp;rsquo;t been set.
var myFunction = function(arg1, arg2){ arg1 = arg1 || 25; arg2 = arg2 || true; //do something } Even this has problems as passing in 0 for arg1 or false for arg2 would both evaluate as &amp;ldquo;falsey&amp;rdquo; and therefore set the default values.</description></item></channel></rss>