Conceptual Question for the interview
INterview question for Javascript ??

Q)Take an array and loop its original Properties. ?
and:- Original properties means you may use an array prototype to insert addition property in it.
i.e. This means you should only loop through the original values of the array, ignoring any extra properties.๐ค
Array.prototype.extraproperty = "SAYAN";
const mynewArray = [1,2,3,4,5]
for(let v in mynewArray){
console.log(v)
}
Output:-
0
1
2
3
4
extraproperty

Correct and:-
for(let v in myNewarray){
if(myNewArray.hasownproperty(v){
console.log(v)
}
}
output:-
0
1
2
3
4
Concept:-- By using prototype we can insert new prototype in an array. but those will not be considered as original properties.
So, to get original props just add a check to array elements using "hasownproperty" syntax.
the "hasownproperty()" method in js in used to check if an object has a property that belong only to itself and is not inherited its prototype chain.๐
![[Backend Project ๐] Realtime Device track | Map with node.js express and socket.io | Maps | Leaflet](https://cdn.hashnode.com/res/hashnode/image/upload/v1752091090482/fe0e12fe-24bf-47a7-805b-79533f4b0a39.jpeg)

![Conceptual Question for the Interview [Part-2]๐ we don't need state for this | react interview question](https://cdn.hashnode.com/res/hashnode/image/upload/v1719954170801/65d50d82-d94e-42df-9f20-fca48254495d.jpeg)