Skip to content
Advertisement

Tag: if-statement

variable (element).style is undefined

why it says variable (element).style is undefined? I tried .style.color=”red”; on a different code & it works! Answer First you have to compare against counter.innerHTML because you update its value.The value of counter doesn’t change and will all the time be 10 as you can see in the snippet below. Second the value of number is counter.innerHTML; This means that

Multiple if/else conditions (discord bot)

I’m trying to create a simple discord bot, currently using nodeJS. I’m creating specific commands that only specific users can use and whenever someone who does not have permission to use such command can get a reply “You don’t have permission”. (I hope you get the idea. sorry for the bad wording). This is my current code: But what happens

Ties are still running win messages?

I’ve been messing around with a rock, paper scissors project that codecademy gets you to try, I’m pretty happy with it but I have one problem! When the result is a tie, it logs the tie message (perfect!) but also logs the win message linked with the result! How do I get it to ONLY log the tie message? Here’s

TypeError: if ‘false’ not working as expected

I’m doing a PWA quiz application using React.js and I’ve met the following problematic: I can get questions objects with only one answer, and some with multiple. In the case there is only one possible answer, I want to force the user to only have one possibility. To do that, I made the following algorithm: However the execution seems to

syntax error unexpected toke in if statement in js

I am receiving a syntax error with unexpected token < at line 14 when i try to run this script in my browser. What i am trying to do is open my classes 5 minutes before class and still open when ran all the way up to 5 minutes before the next class. Answer date.getTime() doesn’t return the time of

Advertisement