The hasAttribute() method of the ProcessingInstruction interface returns a boolean value indicating whether the specified element has the specified attribute or not.
hasAttribute(name)nameA string representing the name of the attribute.
A boolean.
const pi = document.createProcessingInstruction("start", 'name="placeholder"');
console.log(pi.hasAttribute("name"));
// logs:
// true