Message from JavaScript discussions
November 2017
— Hello, im starting with javascript
function calcular() {
while repeticion > 0 {
document.write (palabra)
var repeticion() = (repeticion -1)
}
}
— Which is the problem here? (the variables are previously defined )
— A whole bunch of syntax errors
— Can you help?😔
—
/* Predefined:
repeticion
palabra
*/
function calcular() {
while(repeticion > 0) {
document.write(palabra);
repeticion = repeticion - 1;
}
}
— Thanks
Its obvious i started with python xD
— 1. parentheses around while-condition (while (condition) { block }
)
2. document.write is bad
3. Don't use var
for something that is already defined, just use it like x = y
4. No need for parentheses around (repeticion - 1), you can remove them
5. Why parentheses after the name of the variable?
— What, because he hates class syntax?
— Pfft
— Which part?
— He got banned from a few places because apparently "Dog Balls" in a talk wasn't okay