Posts

Showing posts from May, 2023

JavaScript coding Interview Question

Image
  JS CODE PRACTICE INTERVIEW QUESTION ES6 (also known as ECMAScript 2015) is the sixth edition of the ECMAScript language specification, which is used to define the scripting language used by web browsers. It introduced many new features and syntax improvements to JavaScript that make it easier and more intuitive to write complex applications. In this article, we'll explore some of the most important concepts introduced by ES6 and how they can be used to write better JavaScript code. ES6 JS => let and const Arrow functions Classes Destructuring Template literals Spread operator Default parameters Rest parameters Object shorthand notation Promises Modules Maps and Sets Iterators and Generators. 1. Find a max element in the array using reduce method. const arr=[1,7,3,48,10,39]; const data=arr.reduce((acc,curr)=>{ if(acc<curr){ acc=curr } return acc },0) console.log(data); o/p => 48 2. Counting occurrences of values in an array of objects based on a specific property.