Skip to Content
NFSFU234FormValidation v3 is here — file upload validation, config-driven rules, and more.
v3 (current)checkVariableType

checkVariableType

Returns the runtime type of a variable as a lowercase string (e.g. 'string', 'number', 'object', 'function'), more granular than a raw typeof. Returns: string

ParameterTypeRequiredDefaultDescription
variableanyrequired-The value to check.
Usage
Example: Check Variable Type
const type1 = nfsfu234FormValidation.checkVariableType("Hello"); // "string" const type2 = nfsfu234FormValidation.checkVariableType(123); // "number" const type3 = nfsfu234FormValidation.checkVariableType([]); // "array" const type4 = nfsfu234FormValidation.checkVariableType({}); // "object" const type5 = nfsfu234FormValidation.checkVariableType(() => {}); // "function" const type6 = nfsfu234FormValidation.checkVariableType(null); // "null" const type7 = nfsfu234FormValidation.checkVariableType(undefined); // "undefined" const type8 = nfsfu234FormValidation.checkVariableType(document.body); // "HTML Element"
Last updated on