I need Method to prevent push “Name”
let myData = ["Osama", "Mohamed", "Elsayed", "Elzero"];
myData.push("Name");
console.log(myData); // ['Osama', 'Mohamed', 'Elsayed', 'Elzero']
I tried and searched to find an answer but didn’t find it
I found this method, but give me an error
Object.freeze(myData);
New contributor
Mohamed Wahid is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1