write a program to generte a harmonic series
1+1/2+1/3+1/4+1/5 upto 15 terms.
Answer / upendar
<html>
<head>
<script type="text/javascript">
function hormonicSeries() {
for(var i=1;i<=15;i++) {
if(i == 1) {
var addSeries = 1/i;
} else {
for(var j=2; j<=15;j++) {
if(i == j) {
addSeries = addSeries +"+1/"+i ;
}
}
}
}
var series = addSeries;
document.write(series);
}
</script>
</head>
<body onload="hormonicSeries();">
</body>
</html>
| Is This Answer Correct ? | 4 Yes | 3 No |
What is the Infinity property used for in Javascript?
How will you create new object in javascript?
What is unshift method in JavaScript?
What are the javascript objects?
What is prototype in javascript and how do you use it?
What is the difference between the operators '==' and '==='?
What will be the output of the following code? //nfe (named function expression) var Foo = Function Bar() { return 7; }; typeof Bar();
How do you check if an object is an array or not?
How to open a window with no toolbar, but with the location object?
What are self invoking functions?
What is the difference between innerhtml and append() in javascript?
Can you run javascript in notepad?