Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There missed a ending symbol #16

Open
zhangiser opened this issue Sep 29, 2020 · 1 comment
Open

There missed a ending symbol #16

zhangiser opened this issue Sep 29, 2020 · 1 comment

Comments

@zhangiser
Copy link

zhangiser commented Sep 29, 2020

I have download the kriging.js and use it in my project,but there is a error when i try to change the code like this :

(function(a){
	console.log(a);  
}(1234));

Or like this:

(function(a){
	console.log(a);  
})(1234);

And i got a error
(intermediate value)(...) is not a function

But everything is ok when use it like this:

var fn=function(a){
	console.log(a);   
}(12345678)

And finally,i find there missed a ";" in line 27,the old is:

Array.prototype.pip = function(x, y) {
    var i, j, c = false;
    for(i=0,j=this.length-1;i<this.length;j=i++) {
	if( ((this[i][1]>y) != (this[j][1]>y)) && 
	    (x<(this[j][0]-this[i][0]) * (y-this[i][1]) / (this[j][1]-this[i][1]) + this[i][0]) ) {
	    c = !c;
	}
    }
    return c;
}

When add the ";" at last like this,the error is been fixed

Array.prototype.pip = function(x, y) {
    var i, j, c = false;
    for(i=0,j=this.length-1;i<this.length;j=i++) {
	if( ((this[i][1]>y) != (this[j][1]>y)) && 
	    (x<(this[j][0]-this[i][0]) * (y-this[i][1]) / (this[j][1]-this[i][1]) + this[i][0]) ) {
	    c = !c;
	}
    }
    return c;
};

So don't be lazy,add the ";" at the end of every assignment statement is very important!!!

@oeo4b
Copy link
Owner

oeo4b commented Oct 9, 2020

@zhangiser Can you create a pull request for this bug? I can review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants