skip to Main Content

Javascript – This code changing the image as expected but not the id?

const currentTypesResult=[{id:'155', foodId:'511555522559744444', image: 'Some image string', example:'example'}] const processedResults = currentTypesResult.map((item) => { const { foodId, image, ...rest } = item; return { id: '5542', image: 'data:image/png;base64,', ...rest }; }); console.log(processedResults[0].id) // Prints 155? Why? Why not 5542? console.log(processedResults[0].image)…

VIEW QUESTION

Javascript – How get total in an array of object

I have this array, and i want to get the sum amount of each Order.item [ {"OrderReceiverId":"6698eea782e24cc9d42eab7f", "Order":{ "CustomerId":"669aa55079cce2e96f9a7e69", "CustomerName":"Erigbemi", "Date":"2024/07/19", "TrackingId":"43035", "Status":"Processing", "Amount":{"$numberInt":"25000"}, "Item":"Orange" } }, {"OrderReceiverId":"6698eea782e24cc9d42eab7f", "Order":{ "CustomerId":"669aa55079cce2e96f96t77", "CustomerName":"James", "Date":"2024/07/19", "TrackingId":"42335", "Status":"Processing", "Amount":{"$numberInt":"15000"}, "Item":"Tomatoes" }, {"OrderReceiverId":"6698eea782e24cc9d42eab7f", "Order":{ "CustomerId":"669aa55079cce2e96f9a7e69",…

VIEW QUESTION

Javascript : Find node value through recursive iteration

I have the following structure : var content = { "id": "RkktMTA1OC0wNTE3QElNQi82NTAwNC9YLzAwSDc", "name": "FI-1058-0517", "category": "FTTH", "place": { "id": "SU1CLzY1MDA0L1gvMDBINw", "href": "/geographicSite/SU1CLzY1MDA0L1gvMDBINw", "name": "IMB/65004/X/00H7", "isSiteInfoAvailable": true, "place": [ { "geographicSubAddress": [ { "internalBuildingReference": "SSS0100000000000198332600", "internalFloorReference": "", "buildingName": "_NA_", "levelNumber": "0",…

VIEW QUESTION
Back To Top
Search