Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #13572

Re: Syntax question '/a-b;'

From "Jukka K. Korpela" <jkorpela@cs.tut.fi>
Newsgroups comp.lang.javascript
Subject Re: Syntax question '/a-b;'
Date 2012-04-24 19:59 +0300
Organization A noiseless patient Spider
Message-ID <jn6m63$avi$1@dont-email.me> (permalink)
References <79mdp71k9r37eeeurnhcif3ecfvh9vbbu7@4ax.com>

Show all headers | View raw


2012-04-24 19:50, Joey@still_Learning.invalid wrote:

> I'm looking at a js script and I've come across syntax that's foreign in
> meaning to me. Could someone explain what
>
> width = width/2-150;
>
> Means?

As in normal arithmetics, division has priority over subtraction, so the 
right-hand side is equivalent to (width/2) - 150.

So the width is divided by two, 150 is subtracted from the result, and 
the result of this is assigned back to the variable width.

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Syntax question '/a-b;' "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2012-04-24 09:50 -0700
  Re: Syntax question '/a-b;' "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-04-24 19:59 +0300
    Re: Syntax question '/a-b;' "Joey@still_Learning.invalid" <Joey@still_Learning.invalid> - 2012-04-24 11:32 -0700
      Re: Syntax question '/a-b;' Swifty <steve.j.swift@gmail.com> - 2012-04-26 14:56 +0100

csiph-web