You could slice the array for mapping the items with the delta of the same indices.
var array = [1000, 2000, 5000, 4000, 300, 0, 1250],
result = array.slice(1).map((v, i) => array[i] - v);
console.log(result);
More Related Contents:
- Find Sum of Two Numbers Using JavaScript in 1st one is manual entry and 2nd one is depend
- Javascript: Decimals still being allowed in regex check for numbers [duplicate]
- How to return the response from an asynchronous call
- What is a good regular expression to match a URL? [duplicate]
- When should I use curly braces for ES6 import?
- Why use named function expressions?
- Remove Object from Array using JavaScript
- How to quickly and conveniently disable all console.log statements in my code?
- Pure javascript method to wrap content in a div
- Javascript : Send JSON Object with Ajax?
- Browser Timeouts
- Best practice for using window.onload
- Set attribute without value
- How to convert unordered list into nicely styled dropdown using jquery?
- Adding div element to body or document in JavaScript
- Dynamic NG-Controller Name
- “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error for response from http://www.google.com/
- regex to get the number from the end of a string
- Why do we need both client side and server side validation? [closed]
- With form validation: why onsubmit=”return functionname()” instead of onsubmit=”functionname()”?
- Detect browser character support in javascript?
- change background image in body
- Uncaught TypeError: lang is not a function [duplicate]
- Discord.js v13 code breaks when upgrading to v14
- Group javascript array object by same key
- How to Access styles from React?
- How to get data with JavaScript from another server?
- Show select dropdown in jQuery? [duplicate]
- disable Bootstrap’s Collapse open/close animation [duplicate]
- How to generate an array of the alphabet?