How can I convert an array to a Set in JavaScript, and is there a way to access or delete elements by key instead of index?

If your goal is to access or delete items by a key (name), use a Map:

const map = new Map(array.map(item => [item.name, item]));

// Access
map.get("pablo"); // {name: "pablo", dogType: "two-legged"}

// Delete
map.delete("malcom");

This gives you clean key-based control over your data, and you can still iterate over the Map.