0
var canvasWidth = canvas.width - xPadding;
var canvasHeight = canvas.height - yPadding;
var bw = canvas.Width;

Why does bw become undefined when I try to use it?

3
  • Please provide at least the surrounding scope code Commented Jun 21, 2016 at 6:41
  • 1
    use lowercase "w" on canvas.Width? Commented Jun 21, 2016 at 6:43
  • It's case sensitive , so you should use canvas.width Commented Jun 21, 2016 at 6:45

2 Answers 2

3

width should be in lowercase.

var bw = canvas.width;
Sign up to request clarification or add additional context in comments.

Comments

0

Width should be in lowercase.

And going forward if you are struck anywhere do log the object for a detailed list of variables with in it for you to access them .

For example,

You can console.log(canvas); and in the console TAB of developer option (F12 on most of the browsers) you can find all the variables. That way you can cross check.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.