Expand Minimize

Disallow Global Object Function Calls

Quote from ESLint 'ECMAScript provides several global objects that are intended to be used as-is. Some of these objects look as if they could be constructors due their capitalization (such as Math and JSON) but will throw an error if you try to execute them as functions.'

CheckId SPC018907
TypeName DisallowGlobalObjectFunctionCalls
Severity CriticalError
Type JavaScriptFile

Bad Practice

var x = Math();
var y = JSON();

Good Practice
var x = Math.random();
y = JSON.stringify({});

Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.