Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #39177

Re: JavaScript + DOM, type system

Newsgroups comp.lang.javascript
Subject Re: JavaScript + DOM, type system
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <DOM-20201119215052@ram.dialup.fu-berlin.de> <textContent-20201122215016@ram.dialup.fu-berlin.de>
Date 2020-11-23 15:36 +0100
Message-ID <XnsAC7E9ED9E4143eejj99@194.109.6.166> (permalink)

Show all headers | View raw


ram@zedat.fu-berlin.de (Stefan Ram) wrote on 22 Nov 2020 in 
comp.lang.javascript:

> PS: I only now see (skimming through my notes from a recent course)
>   that participants of my course lost all inhibitions and really wrote
>   code like
> 
> ++a.textContent 

<div>123</div>

let a = document.querySelector('div');
++a.textContent;
++a.innerHTML; 

and

const b = document.querySelector('div');
++b.textContent;
++b.innerHTML;

// 127 / So both are fine.


>   , and it "worked" in the Browser, incrementing a numeral on the web
>   page by one. I was flabbergasted, but not able to immediately come
>   up with a convincing reason why they should not do this.

Next thing they'll do is:

const c = 7;
let d = c++;
// Uncaught TypeError: Assignment to constant variable.

And they will be the wiser.

btw Google: A 'constant variable' is nonsense.


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next | Find similar | Unroll thread


Thread

Re: JavaScript + DOM, type system "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-11-23 15:36 +0100

csiph-web