Skip to content
Advertisement

Tag: arrays

Get matched range item from array of objects javascript

I have one array which is named as tiers and one quantity variable. Now I am trying to get the matched range value from my tier array. Based on the matched result I want to calculate the discount. I tried to with find method but it gives me an unexpected ouput. Actual output {id: 1, discount_percent:0, quantity:6, title:”Tier 1″} Expeceted

Add object to array in class component

I have a list of products (unordered list which I apply at the beginning and it shows on screen) and after click on one of them for example: milk, app should add it on screen to list “to buy”. But it shows on the screen after I click on another element or second time on the first one. It also

Advertisement