This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Interval(func,duration){ | |
if(typeof func !== "function") throw new TypeError("Expected function"); | |
else if(typeof duration !== "number") throw new TypeError("Expected number"); | |
this.func = func; | |
this.duration = duration; | |
this.baseline = +new Date(); | |
(function(_this){ | |
_this.timer = setTimeout(function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<meta charset="UTF-8" /> | |
<script src="linreg.js"></script> | |
<title>Linear Regressions in JS</title> | |
<script> | |
function $(d){return document.getElementById(d)}; | |
var canvas, textarea, func = "linreg"; | |
window.onload = function(){ | |
canvas = document.getElementById("view"); | |
textarea = document.getElementsByTagName("textarea")[0]; |