This content originally appeared on DEV Community and was authored by lionel-rowe
const praiseBeToCthulhu = (len) => {
const obj = { a: '"' }
obj.b = ''
const codepoints = JSON.stringify(obj).split('')
.map(ch => ch.codePointAt())
const grab = (n) => codepoints.slice(n).shift()
const x = grab(6)
const y = grab(9)
let s = String.fromCharCode(x - 1)
for (let i = 0; i < len; ++i) {
s += Object.getPrototypeOf(
Object.getPrototypeOf(
Object.getPrototypeOf(
Object
)
)
)
s += String.fromCharCode(y)
}
if (s.length > 1) {
const z = s.split('')
z.pop()
s = z.join('')
}
s += String.fromCharCode(x + 1)
return JSON.parse(s)
}
OK, there are definitely more concise ways, but hey, maybe you're getting paid by the number of lines of code you write.
Thank-you for coming to my TED talk. 🙇♀️
This content originally appeared on DEV Community and was authored by lionel-rowe
lionel-rowe | Sciencx (2022-01-05T07:45:22+00:00) How to create a null-filled array without [], comma, or the word “Array”. Retrieved from https://www.scien.cx/2022/01/05/how-to-create-a-null-filled-array-without-comma-or-the-word-array/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.