Skip to content

Tag: arrays

Only half of array gets raised to power

I wanted to create binary to decimal calculator. When i tried to console log both of arrays (binary is array of 0’s and 1’s, binarypos is array of numbers that are powers of 2. Screenshot Then i created simpler version, made in console so chance of making a mistake lowered to zero. But the bug app…

How do I use $addToSet with objects in mongodb?

I want to push only unique objects into an array with $addToSet. My userSchema has a field bankDetails which should take an array of objects: I am updating the schema using the following controller function: The data is saving correctly but Mongo auto generates an _id field every time so technically none of t…

New Set Array returing Wrong data

I am trying to get distinct coaGrpId from ldgrwisesum useState but getting null values in array object and length as 310 which is my requires array object. below is the ldgrwisesum useState from where i stored the data i am expecting o/p in variable b .Below is the Expected output I have getting 310 times nul…

Javascript compare two tables

I need help with comparing two tables that presents like this: I need to check if the table A contains numbers from table B and to put it in another array: Expected output: Tried a few things but nothing works out for me. The table.includes method gives me following output }); // That is the output of above i…