const obj1 = { name: "kim", age: 14 };
const obj2 = { name: "Steve", age: 20};
const arr = [ obj1, obj2];
arr[0]["name"].includes("han"); // true
so this is the code that I am curious.
I think includes() method is for array, not for object.
but in this case arr is array but arr[0] is object. also arr[0]["name"] is property of object, then why is it possible to use includes method on this code?
I would be grateful if someone tell me what I know wrong
true. Instead, it should givefalse. BTW you are usingincludeson a string, not on object. if you would have used any substring fromkimthen you would have gottruearr[0]["name"](orarr[0].name, same thing) is a string. See String.prototype.includes()