Office Scripts throws error when using console.log() in Array.prototype.reduce()
I was trying to test using a console.log statement with Array.prototype.reduce() and received an error. You can see the code below:
let arr = [1,5,4,2,3];
let firstVal = arr.reduce((prev,curr)=>{
console.log(`prev is ${prev}`)
return prev
})
console.log(`firstVal is ${firstVal}`)
The error I get in Office Scripts is just "unexpected". The script works fine if console.log is disabled or commented out.
The code I wrote above works fine in other JavaScript environments e.g. Node.
Hi @b-gonzalez,
I believe the problem here is that the version of TypeScript used by Office Scripts is an older one (4.0.3, as mentioned in this issue). The product team has oscillated on solutions, so this is a good opportunity to re-raise the concern.
We should also document that version in the official docs. Assigning @alison-mk to do that.