Message from JavaScript discussions

November 2020

— That would be awful, frankly, lol. Webassembly has come a long way though

— 

Guys could anyone help me with the js code for
Incrementing a badge counter on button click.
I tried it when the default badge counter value was 1 and I used

window. Onload = ()=>{

Let counter =0;

// Set default value
getElementById('btnAddBadge'). innerHTMl =counter;

document. getElementById('btnAddBadge').onclick = (e)=>{

document.getElementById('badgeValue').innerHTMl = counter++;

};

};

But the error I get that the code runs but it starts incrementing from when u click the button the second time..
But when u click the first time. I makes the counter 1 but doesn't affect the badge en when u click again . I them adds 1 to the badge

— It's called postincrement for a reason

— Try ++counter if you're after that syntax

— Thanks.. now it has worked.. 😊

— Hi everyone!
Someone knows how to obfuscate TS/JS strings in code?

— btoa('string')

— Hmmm, I'm looking for somethink like mimify the code

— Ah. why didn't you say so

— Sorry for my bad explanation

— Use webpack/rollup whatever to minify automatically

— I have a cli and I cannot use webpack :(