JavaScript Type-Based Conditional Logic

Descripción

Type-based conditional logic using typeof and instanceof


File Template: ❌


Prefix

type:check


Scopes

javascript


Snippet de código

if (${1:obj} === null) return ${2:0};
if (typeof $1 === "string") return $1.length;
if (typeof $1 === "number") return $1;
return ${3:-1};