💾baseTypeName()
JS ⟩ value ⟩ type ⟩ name ⟩ baseTypeName()
💾 replit:isClass()
👉 compare: typeName()
(to use it, copy and paste from 📁 module file: typeName())
// ⭐ base type name
function baseTypeName(value) {
// --------------
// ↓ ↱ -1 (index of last character)
// 0123456789012
// ╭──╮
// "[object XXXX]" ╭───╮
// ^^^^ <---- slice(8, -1)
return Object.prototype.toString.call(value).slice(8, -1);
}
Last updated
Was this helpful?