Curtis Timson

Front End & .NET Developer



Default parameters with ES6

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’t been set. var myFunction = function(arg1, arg2){ arg1 = arg1 || 25;… Continue Reading →

Round to the nearest decimal

If we need round to the nearest whole number, we can use the Math.round() function to return this: Math.round(1.34234); //returns 1 However what if we need to round to a decimal place? For example 0.5. The following function can be… Continue Reading →

Check javascript function exists before calling it

On large applications, there may be some instances where you need to make a call to a function which belongs in a different javascript file. There might also be a case where this javascript file isn’t always included on every… Continue Reading →

© 2017 Curtis Timson — Powered by WordPress

Theme by Anders NorenUp ↑