Im having an issue with displaying javascript output without any user action

后端 未结 2 1548
日久生厌
日久生厌 2021-01-26 12:23

this is the Question: An integer is said to be prime if it is greater than 1 and divisible only by 1 and itself. For example, 2, 3, 5 and 7 are prime, but 4, 6, 8 and 9 are not.

2条回答
  •  野性不改
    2021-01-26 12:54

    You're importing the script in the , so that's where it's output will go. Try moving it to the .

    That's possibly the slowest way to find primes.

    edit — another problem is this:

                for(int i=2;i

    There is no int keyword in JavaScript - it's var. That would cause a syntax error, which would show up in the error console. Neither is there a boolean keyword (declaration of "prime"). It's important to keep the error console open while doing any HTML/JavaScript development.

提交回复
热议问题