Javascript Array — interview coding questions

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));

--

--

--

Full stack developer, Blogger, Poet, Writer

Love podcasts or audiobooks? Learn on the go with our new app.

Javascript Closures

No-Brainer HTML, JS, CSS and cypress.io testing starter tutorial — Part 2

JS Currying is multi step Form

ReactJS in a nutshell

SEO Friendly Route in ReactJS

JavaScript — Tricky World

Introduction to micro frontends architecture

Long story short, I’ve selected web-framework for next project

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akarsh Saraff

Akarsh Saraff

Full stack developer, Blogger, Poet, Writer

More from Medium

JavaScript Blogs 2022

“this” in Javascript

Difference between export as class and object in javascript ?

Understanding JavaScript's ‘this’ keyword