try using spread operator while pushing to the expiredPlans like .push({...foundUser.currentPlan})
That worked 😱😱😱 But how???
Thankyou so much brother 👍
In JS there are two types of copying things, copy by value and copy by reference. Arrays and Objects use copy by reference. By using spread operator, you can kinda "clone" your object. In your free time you can have a look at the topic) Here's the sample article: https://www.geeksforgeeks.org/pass-by-value-and-pass-by-reference-in-javascript/
Обсуждают сегодня