Seems the problem is that you are trying to compare the array values as numbers and you currently have them as strings. To convert them to numbers, you can simply use:
bookedSeats = bookedSeats.map(Number) // iterate over each bookedSeats element and return its numeric value
Which is the same as:
bookedSeats = bookedSeats.map(function(value){
return Number(value);
})
From the comments it looks like your variable bookedSeats is being assigned with values. However, if your init() function is expecting integers, you'll want to build the bookedSeats array with integers like so:
for(var i =0 ; i <getBookedSeats.length ; i++){
bookedSeats[i] = parseInt( getBookedSeats[i], 10 );
}
Like in array destructuring we can do something like this: let [, b] = [1, 2, 3, 4, 5] so why not foo(, b)?
Like in array destructuring we can do something like this: let [, b] = [1, 2, 3, 4, 5] so why not foo(, b)?
I'm trying to understand how asynchronous testing works in Jest. What I'm trying to do is similar to an example from the Jest documentation. This works fine .. function doAsync(c) { c(true) } ...
I'm trying to understand how asynchronous testing works in Jest. What I'm trying to do is similar to an example from the Jest documentation. This works fine .. function doAsync(c) { c(true) } ...
We are using Temenos T24 as core banking platform. There are three layers in application: front-end REST API T24. REST API connects with T24 via TOCF and returns response in JSON format to front-...
We are using Temenos T24 as core banking platform. There are three layers in application: front-end REST API T24. REST API connects with T24 via TOCF and returns response in JSON format to front-...
I have this object: let arr = [{ id : 1, usr : 'pimba', xyz: null }, { id : 2, usr : 'aloha', xyz: { xyz_id: 2 } }, { id : 3, age : '...
I have this object: let arr = [{ id : 1, usr : 'pimba', xyz: null }, { id : 2, usr : 'aloha', xyz: { xyz_id: 2 } }, { id : 3, age : '...