here is my code piece
const date = new Date()
let exactTime = date.toLocaleString('en-KL', { hour: 'numeric', minute: 'numeric', hour12: true })
const signUp = (username,email,password,isLoggedIn) => {
let obj = {
_id: 'ddfcd',
username: username,
email: email,
password: password,
createdAt:`${date.getDate()}/${date.getMonth()}/${date.getFullYear()} ${exactTime}`,
isLoggedIn: isLoggedIn
}
let arr = [`${users2.length}`, obj]
let collection = Object.entries(users2)
collection.push(arr)
users2 = collection
}
signUp('ali','[email protected]','123',false)
signUp('kerem','[email protected]','456',false)
signUp('johndoe','[email protected]','789',true)
when i get new user data at first the new one is exacrly similar with the rest however when add second one (or more) it misses an array it just turns array into object
here is the example what i mean when i add one more user then the previous one gets normal
what’s the problem here