Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
pakoch

Assignment Operators

Recommended Posts

Hi, I am just starting to learn Javascript and I have a quick question about these statements.

 

total -= discount;

 

total *= tax;

 

Translated to English, does the first one mean: The total minus the discount equals some value?

The second one: The total multiplied by the tax equals some value?

 

Thanks,

 

Peter Koch

Share this post


Link to post
Share on other sites

Basically it would be written as this. It just takes the discount value and subtracts it from the total and assigns the new value to the total variable. The second one would be the same except with the multiplication operator.

total = total - discount;

  • Upvote 1

Share this post


Link to post
Share on other sites

Welcome to the forums, Peter Koch.

Not sure if you know this, but there is a really famous web developer named Peter-Paul Koch (know as ppk) that started the QuirksMode website.

Very interesting coincidence.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...