Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
Output
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 = '${i} | '; 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started