Message from JavaScript discussions

August 2020

โ€” U prolly mix up Array.prototype.includes and the object key in operator

โ€” 

In just controls if the key exists

In your example you got the VALUES 1 and 2, but they got keys which are 0 and 1

โ€” Thnx Mate!๐Ÿค

โ€” Y do u do dis determin1st

โ€” This is the explanation

โ€” ๐ŸŽ‰

โ€” Except, i would not use in neither for array nor object

โ€” Because, 1 in a means that array is sparse - you failed to make data structure solid, probably created it with something like:

a = []
a[0] = 0
a[2] = 2
real thugs check index in array with index < a.length

Message permanent page

โ€” <empty> is a useful thing

โ€” Wat empty๐Ÿคจ html something or

โ€” Language:

js


Source:
let arr = [];

arr[0] = '0';
arr[2] = '2';

console.log(arr);
// โ†’ ['0', <empty>, '2']


Result:
[ '0', <1 empty item>, '2' ]

Message permanent page

โ€” Any React Native developer here?