Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8091847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:09:33+00:00 2026-06-05T20:09:33+00:00

I am playing around with the HTML canvas and write some text on it

  • 0

I am playing around with the HTML canvas and write some text on it using Javascript.

While doing this I made a simple error which took me some time to find. I wrote:

context.fillText = ("My message", x-coord, y-coord);

The equal sign prevented the behavior I expected. But there is one thing I do not get: Why does this code not give me an error in the Javascript console of Chrome?

Is this valid Javascript? If yes: Could you explain whaat the code does when the equal sign is there?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:09:34+00:00Added an answer on June 5, 2026 at 8:09 pm

    Yes that is valid Javascript. It is using the comma operator, which just evaluates the expression on the left, then the one on the right and returns the value of the one on the right.

    Since the expressions "My message" and x-coord have no side-effects, it is the same as:

    context.fillText = y-coord;
    

    Or:

    "My message"; // Does nothing
    x-coord;      // Does nothing
    context.fillText = y-coord;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using HTML 5 for the first time, and playing around with this
I was playing around with some ideas using raw html and JQuery. One thing
I been playing around with some custom html helpers and I now I am
just a simple question i am stuck with. i am playing around with some
I'm playing around, trying to write some code to use the tr.im APIs to
I am playing around with HTML 5 apps according to this tutorial: http://sixrevisions.com/web-development/html5-iphone-app/ It's
I am new to HTML and javascript. Was playing around with it and faced
I've been playing around with prototypal inheritance after reading http://javascript.crockford.com/prototypal.html and having a bit
I'm playing around with HTML5. For that purpose I created some small Javascript widget
I have been playing around with text in the canvas, and although it is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.