Reverse a number

Method 1:

let num = 12345;

function reverseNumber(item) {
let newNum;
let array1 = [];
newNum = num.toString().split(‘’).reverse().join(‘’);
return newNum;
}

alert(reverseNumber(num));

Remove a key value pair from array

let array1 = [
{firstName : ‘akarsh’, lastname : ‘saraff’, company: ‘somecompany’},
{firstName : ‘raju’, lastname : ‘fednes’, company: ‘somecompany’}
]

let newArray = array1.map(({company, …rest}) => ({
…rest
}));

alert(JSON.stringify(newArray));

--

--

Akarsh Saraff

Akarsh Saraff

Full stack developer, Blogger, Poet, Writer