Skip to content

Tag: variables

how javascript handles variables in objects?

I have a question about declaring a variable in an object. Assuming that global or window is also an object, why is it not possible to declare a variable using let in an object that is a child of the window object? I do not understand that. Thanks for the answer and sorry for the English but I hope you

Proper variable name for find method [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 months ago. Improve this question I’m Japanese web developer. I’m currently thinking about the proper variable name for the result from javascript find method. I would

discordjs v13 – subtract the variable

The code doesn’t work when it subtract the variable (enemy’s health) This is my code I wonder at the damage – ene_health why it doesn’t subtract the enemy’s health I am using discord.js v13 and quickdb Answer isn’t doing anything. In your case you have to CHANGE the damage variable. or even better, use the Substract assignment :

How can I assign forEach to variable? Its possible?

Hello everyone:) I’m trying to write rock, paper, scissors game but I have a little problem. Is there any option to assign let playerChoice = buttons.forEach… to any variable as I did in this code? Unfortunately, it doesn’t work like this. I attached my code below. Thanks for any tips! Answer You can’t use forEach to do what you want

Variable ‘value’ is used before being assigned

My code: And got this: I found this very odd, as I had seen other similar problems that either used a callback or a Promise or some other asynchronous method, while I used just a synchronous for loop. ———————————- Some update ———————— Answer Use the non-null assertion operator to ensure that “its operand is non-null and non-undefined in contexts where