Fibonacci Series

So I am really not too good at coding on the fly, and really fumbled the coding portion of my recent interview. So I decided to devote several hours trying to make a working copy in HTML and JS.

by Johnny J.

HTML

<input type="number" id="myNum" value= "15" >   
 <button onclick="myFunction()">Try it</button>  
 <div class="results"></div>

JavaScript

function myFunction() {
var fibArray = [0,1];
//var num = prompt("Enter the limit to generate fibonacci no",10);
var num = document.getElementById("myNum").value;
//console.log(x);
for(var i=fibArray.length; i<num; i++) {
    fibArray[i] = fibArray[i-2] + fibArray[i-1];
}
document.querySelector('.results').innerHTML = fibArray;
//console.log(fibArray);	
}