i’m a newbie in javascript.
Please help me to solve this problem.
How to slice an array to get only the last 2 numbers in that array – JavaScript, like this:
[1234, 5432, 765764, 546542, 234, 5454] to [34, 32, 64, 42, 34, 54]
Thank you!
>Solution :
You can use the map() method.
const array = [1234, 5432, 765764, 546542, 234, 5454];
const arrayMap = array.map(x => x % 100);
console.log(arrayMap);