array.reduce functionality giving different results in different nodejs version

72
January 23, 2020, at 5:30 PM

bit of a weird issue: I'm trying to use array.reduce to get the most recent date from an array of dates (returning null if an empty array was supplied), and I get different outcomes depending on the version of nodejs (v12.14.1 vs v10.17.0).

$ node
Welcome to Node.js v12.14.1.
Type ".help" for more information.
> mapped = [new Date("1/1/1970")].reduce((a,b) => (a>b?a:b), null)
null

And on the other machine:

$ node --version
v10.17.0
$ node
> mapped = [new Date("1/1/1970")].reduce((a,b) => (a>b?a:b), null)
1970-01-01T00:00:00.000Z

Which is the result I want.

Can someone explain why this is happening - did the implementation of the array reduce function change between versions?

READ ALSO
How to subtract 2 values from an API in JavaScript

How to subtract 2 values from an API in JavaScript

I have an object profile that has property Hours and SchedHoursI am attempting a ternary operator that subtracts Hours from SchedHours if Hours is a greater value then SchedHours

111
Js Barcode: generate on the server a raster file of the barcode

Js Barcode: generate on the server a raster file of the barcode

i'm using Js Barcode for generating barcodes for a web app running on Apache and written in PHPThis library creates barcodes using tag and calling JsBarcode function

108
Upload an Embedded Image of Picture taken in Browser

Upload an Embedded Image of Picture taken in Browser

I can't figure out how to take an embedded photo output from a camera and directly upload it to a websiteIt seems like I should be able to take that embedded source and upload it directly without storing the file to the device it was taken on before upload

78