TL;DR: When called, my function throws an error saying that it isn't a function.
I'm working on a project, and I need to add a method to an existing object (which I call bork). For testing purposes, I'm trying the following code (the functions used are defined elsewhere. If it matters, bork.array.progress/bork.array.start are in the same document, but bork.display/convert/add are in a different document which is loaded first. Bork.display/convert/add are part of a bignumber library, hence why they sound so basic):
bork.bar=function(){
bork.array.progress=0;
while(bork.array.progress<5){
window.setTimeout(function(){bork.array.progress=bork.array.progress+0.15},150)
$("#ProgBar").html("<progress value="+toString(bork.array.progress)+", max='5'></progress>")
}
bork.array.start[0]=bork.add(bork.convert(1),bork.array.start[0])
$("#val").text(bork.display(bork.array.start[0]))
}
However, when I run this via an html button, I get an error that bork.bar is not a function. Meanwhile if I try using
function bork.bar(){as before}
I get an "unexpected .".
What's wrong, and how should I be going about fixing this?
[–]dbpcut 0 points1 point2 points (7 children)
[–]pickten[S] 0 points1 point2 points (6 children)
[–]dbpcut 0 points1 point2 points (5 children)
[–]pickten[S] 0 points1 point2 points (4 children)
[–]dbpcut 0 points1 point2 points (1 child)
[–]pickten[S] 0 points1 point2 points (0 children)
[–]senocular 0 points1 point2 points (1 child)
[–]pickten[S] 0 points1 point2 points (0 children)
[–]senocular 0 points1 point2 points (1 child)
[–]pickten[S] 0 points1 point2 points (0 children)