I got this error when I try to execute the following code, I am using Ionic3 framework:
ERROR TypeError {stack: "TypeError: Object [object Array] has no method 'in… (http://192.168.0.25:8100/build/main.js:4116:76)", message: "Object [object Array] has no method 'includes'"}

// console.log(this.events) => [7704]
// console.log(event.id_calenda) => 7653
if (this.events.includes(event.id_calendar)) {
It happens in my device with Android 4.4.4, the other one with Android 7 works good, why?
I fixed it using Array.prototype.indexOf() instead of Array.prototype.includes():
if (this.events.indexOf(event.id_calender) >= 0) {
Array.prototype.indexOf() documentation
Array.prototype.includes() documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With