ok so say I have two files, "main1.js" and "main2.js", I have a variable in main1.js that I want to be in sync with main2.js, (let's say the variable
hyperupcallFrom the repl you linked, it won't work because you did not designate your scripts to use ES Modules :).
Like this:
When you're importing using ES Modules, you don't add scripts tags for them in your HTML because your're asking the server for the file with this line (in your main2.js)
import { num } from './main1.js';
It's worth noting that when you write the filename, you have to prefix the file the name with some absolute or relative path "/main.js", "./main.js", or to some url: "https://exa4 years ago
Vandesm14Remove the "var" from the statement and it should work.4 years ago
Hello this is a game that i made, i might make a few more changes here and there but im mostly dont with it.
HTML, CSS, JS
OWEN5179980Could you add the option to change the number format to scientific so that i can better see how much i have, or even just having b, t, q, qn, etc behind the numbers
2 years ago
nwilson2314i have a suggestion. can you make a second button that adds multiplier so it makes more buildings/money?3 years ago
nwilson2314mmmmm yes building make building3 years ago
Hello! I am making a game that requires some pretty big numbers, so I was wondering how I could change the numbers to scientific notation
PS if it wo
a5rocksWell, I don't really know js, but here's what I think would work:
var number = NUMBER_HERE;
var suffixes = ["", "k","M","B","T","q","Q","s","S","O","N"];
var suffix = suffixes[Math.floor((String(number).length-1)/3)-1];
var numberwithsuffix = String(number) + suffix;
`4 years ago
each button has its own error, its acting as if they are undefined even though i know they are
https://repl.it/@Aidan72/No-name-game
Geocube101That error is normally thrown when there is another error in your code in which
Javascript is not loaded and therefore, the functions don't exist
Line 328: Remove the '6' in front of 'bldg1amountD'
Line 321 - 327: There is no html element with that ID
4 years ago
I keep getting this error
TypeError: Cannot set property 'innerHTML' of null
at bldg1click (https://replbox.repl.it/data/webhosting1/Aidan72/No-na
ArchieMacleanYou need to move your link to the script:
to the end of the file (just before the closing ` tag). This is because when you link to a script at the start of a html file, it only gets the html up to the point it was linked to - so it can't get the innerHTML` because it can't find the span with id "money".
Please upvote if this helps :)4 years ago