Re:Tricks I wish I knew when I learned TypeScript
by IggleSniggle on Tuesday October 12, 2021 @05:26PM
(#28845280)
Did anybody else have their brain do a weird backflip seeing `Array.isArray[0]`??
Object.getOwnPropertyDescriptors(Array.isArray)
/*
{
'0': {
value: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray',
writable: true,
enumerable: true,
configurable: true
},
length: { value: 1, writable: false, enumerable: false, configurable: true },
name: {
value: 'isArray',
writable: false,
enumerable: false,
configurable: true
}
}
*/
Re:Tricks I wish I knew when I learned TypeScript
by panzerklein on Wednesday October 13, 2021 @03:03AM
(#28849063)
How did you get that result? I only see length and name.
Re:Tricks I wish I knew when I learned TypeScript
by IggleSniggle on Wednesday October 13, 2021 @07:18PM
(#28858745)
Well, it was a kind of a joke intended for the folks whose brain saw the comment the same way I did. I got the result by applying the footnote to the object, as half-suggested by syntax of the parent:
Array.isArray[0] = urlString
[0]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...