JS Learnings – 2

Simple JavaScript function.

Functions with additional or missing arguments

Making the add function smarter

In the previous example, when the function receives less than three parameters, then it would return NaN. This example fixes that by checking if the incoming parameter is undefined or null and then substituting that with numberal zero.

Leave a comment

Your email address will not be published. Required fields are marked *