What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-02-28 11:05:09
get last element of array javascript
// Method - 1 ([] operator) const arr = [5, 3, 2, 7, 8]; const last = arr[arr.length - 1]; console.log(last); /* Output: 8 */ // Method - 2 (Destructuring Assignment) const arr = [5, 3, 2, 7, 8]; const [last] = arr.slice(-1); console.log(last); /* ... Add solution -
-
Javascript 2021-10-23 03:50:13
missing data added between two points javascript
var latA=32.718835, lonA=-16.761171, latB=32.711461, lonB=-16.911347, lat = Math.floor(latA * 1e6), // use integers lon = Math.floor(lonA * 1e6), countLat = Math.floor(Math.abs(latA-latB)*1e6)+1, countLon = Math.floor(Math.abs(... Add solution