JSFiddle - React, Tailwind, and code Playground

by HemalathaThanigaivel

JavaScript

const add = {
  a: [1,2,4],
  b: [1,3,4],
  c: [1,2,3]
}

const total = Object.values(add).reduce((t, b) =>{
  return t + b[1]
} , 0)

console.log(total)


var array = [2, 5, 5, 5, 9];
console.log(array)
var index = array.indexOf(5);
if (index > -1) {
  array.splice(index, 1);
}
// array = [2, 9]
console.log(array);