const sentence = 'The quick brown fox jumps over the lazy dog.';
let index = 5;
console.log(`An index of ${index} returns the character ${sentence.at(index)}`);
// "An index of 5 returns the character u"
index = -4;
console.log(`An index of ${index} returns the character ${sentence.at(index)}`);
// "An index of -4 returns the character d"
const array1 = [5, 12, 8, 130, 44];
let index = 2;
console.log(`An index of ${index} returns ${array1.at(index)}`);
// "An index of 2 returns 8"
index = -2;
console.log(`An index of ${index} returns ${array1.at(index)}`);
// "An index of -2 returns 130"
clsx, twMerge, cn, shadcn-ui (0) | 2024.07.05 |
---|---|
toJSON(), JSON.stringify() (1) | 2024.06.18 |
scrollHeight, scrollTop (0) | 2024.06.18 |
TextDecoder() (0) | 2024.06.14 |
ArrayBuffer, TypedArray, Int8Array, Unit8Array (1) | 2024.06.14 |