Question: I need help with my javascript code which some numbers are missing in the table such as 10, 21, 32, 43, etc. Output Js table.js

I need help with my javascript code which some numbers are missing in the table such as 10, 21, 32, 43, etc.

I need help with my javascript code which some numbers are missing

Output

in the table such as 10, 21, 32, 43, etc. Output Js

Js table.js > generate Table 1 function isPrime(num) { 2 for (var i = 2; i 1; 6 } 7 8 function generateTable() { 9 var limit = window.prompt("What is the loop maximum (between 1 and 500)?"); 10 11 if (limit 500) { 12 alert("Invalid input limit, setting to default value 100"); 13 limit = 100; 14 } 15 16 var textCode = '

Below is a table that was created dynamically, showing the 17 sequence of numbers from 1 to ${limit} with all of the Prime Numbers 18 highlighted blue (or in Bootstrap terms using the 19 class="bg-primary text-white")

20 var tableCode = '

'; 21 22 for (let i = 0; i '; 24 25 var k = i; 26 27 for (let j = i; j ${i}'; 32 } 33 else tableCode += ''; 34 i++; 35 36 if (i > limit) break; 37 } 38 tableCode += ''; 39 } 40 tableCode 1 41 42 document.getElementById("list_placeholder").innerHTML = textCode; 43 document.getElementById("primeTable").innerHTML = tableCode; 44 } 45 0 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 33 34 35 36 37 38 39 40 41 42 44 45 46 47 48 49 50 51 52 53 55 56 57 58 59 60 61 62 63 64 66 67 68 69 59 | 70 71 72 73 74 75 77 78 79 80 81 82 83 84 85 86 88 89 90 91 92 93 94 95 96 97 99 100 101 102 103 104 105 106 107 108 110 on 111 112 113 114 115 116 117 118 8 | 1 119 121 122 123 124 125 126 127 128 129 130 132 133 134 135 136 137 138 139 140 141 143 144 145 146 147 148 149 150
${i}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!