This is a Placeholder Polyfill script example from book ‘JavaScript & jQuery – Interactive Front-End’ {see the pic}.
Problem script screenshot

In the highlighted script line numbered as (7) in the pic, condition (!el.placeholder) inside ‘if’ depends on ‘placeholder’ being a implemented as a property of element ‘el’ so that it can have falsy or truthy values. While the basis of this script is to run only when browser does not support ‘placeholder’ property in form elements, it seems to me as an incorrect example.

I am a still a novice self-learner web developer. I just want to make sure if I am correct and this example is wrong according to my understanding. And if I am wrong (book is correct) please kindly explain in detail.

New contributor

Animesh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.