write a program to generte a harmonic series
1+1/2+1/3+1/4+1/5 upto 15 terms.



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

Post New Answer

More JavaScript Interview Questions

What is a closure javascript? Explain

0 Answers  


What is an Event Bubbling in Javascript?

0 Answers  


What is null variable?

0 Answers  


What are escape characters in javascript?

0 Answers  


What is object cloning

3 Answers  






Explain window.onload and ondocumentready?

0 Answers  


Entire content of a JavaScript source file in a function block?

0 Answers  


Explain how can you submit a form using JavaScript?

0 Answers  


What are the different types of errors available in javascript?

0 Answers  


hi iM rahul.my questions is my project is a web based & developed using java,jsp. when i record it using qtp what script i will get like either browser("jdfjkf").page("nkf").... or javawindow("f d ").javaedit("Dasf").... plz clarify my doubt asap and i also need some vbscipt of java coding?

0 Answers  


List some unit testing frameworks javascript

0 Answers  


How do you trim in javascript?

0 Answers  


Categories