Took only 59 seconds to code JavaScript prototype to generate composite number series. Here is the code snippet.
Code (Run Code):
arr = [];
function checkComposite(num) {
if (num == 1) {
return false;
} else if (num == 2) {
return false;
}
for (var x = 2; x < num; x++) {
if (num % x == 0) {
return true;
}
}
return false;
}
function compositeNumbers() {
num = Number(document.getElementById('number').value);
for (var j = 1; j < num; j++) {
if (checkComposite(j)) {
arr.push(j);
}
}
document.getElementById('result').innerHTML = arr;
}
I read this article, it is really informative one. Your way of writing and making things clear is very impressive. Thanking you for such an informative article.coding for kids where to start
ReplyDeleteFinal year engineering projects final year projects for computer science are a great opportunity to apply theoretical knowledge to practical problems and showcase your skills to potential employers. Here are some project ideas across various engineering disciplines:
DeleteNice info, I am very thankful to you for sharing this important knowledge. This information is helpful for everyone. Read more info about Online Tutoring. So please always share this kind of information. Thanks.
ReplyDeleteVery well written article. It was an awesome article to read. Read more info about Coding Courses in Adelaide. Complete rich content and fully informative. I totally Loved it.
ReplyDeleteGreat job for publishing such a nice article. Your article isn’t only useful but it is additionally really informative. Thank you because you have been willing to share information with us.IELTS classes in Surrey
ReplyDeleteYou are providing good knowledge. It is really helpful and factual information for us and everyone to increase knowledge.about Online Tutor. Continue sharing your data. Thank you.
ReplyDelete