Reputation: 3099
var canvas = document.createElement('canvas'),
ctx = canvas.getContext("2d"); //Create the context
//more code (width, height defined elsewhere)
ctx.beginPath();
ctx.moveTo(0.35 * width, 0);
ctx.lineTo(0.35 * width, 0.65 * height);
ctx.lineTo(1 * width, 0.65 * height); //JSHint is complaining about the 1 here
ctx.stroke();
Why am I getting an error here?
Upvotes: 2
Views: 244
Reputation: 2413
Why don't you just use :
ctx.lineTo(width, 0.65 * height);
as far as i can tell 1 * anything will most likely give the same result
Upvotes: 0
Reputation: 1577
It is a meaningless operation, multiplying by 1 doesn't do anything. Just use width.
Upvotes: 5