English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

related to javascript

2006-06-18 03:56:45 · 6 answers · asked by farhat_hasan57 1 in Computers & Internet Programming & Design

6 answers

Ah they are Common operator notation, we use it to to express mathematical sequences using tokens.

Postfix and prefix are mainly used for computer programming, that is how the computer thinks when doing operational sequences of numbers. We use postfix and prefix to do lexical analysis as well. Take a look at the webpage and you will know what I mean:)

Take a look at Wikipedia they have a great article

2006-06-18 04:03:31 · answer #1 · answered by ? 6 · 1 0

y = o;
x = 1;
y = ++x;
prefix fist add 1 to x then give value to y.
so y will be 2.

same...
y = o;
x = 1;
y = x++;
postfix will y be 1 cause first value is given to y then x is incremented

2006-06-18 12:18:59 · answer #2 · answered by Anonymous · 0 0

Let me explain this using a simple example:

var i = 0;
var j = i++; // here j would be assigned 0, and i would subsequently incremented to 1
var k = ++i; // here i would be incremented from 1 to 2, and would be assigned to k

When you use it in a statement that doesn't use assignment, there is no difference[1].

// both mean the same
i++;
++i;

[1] In compiled languages, usually the compiler optimizes "++i" better than "i++", since for the "++i" it uses the processor's increment operator, while for the "i++", it uses the add operator which is a little slower since it uses 2 cycles.

2006-06-18 11:05:00 · answer #3 · answered by Anonymous · 0 0

lets do it with an exampl:
++a and a++
in the 1st case the value of a is 1st incremented and then used in the given equation.
however in the 2nd case the value of a is 1st used in the equation n then incremented.

2006-06-18 11:04:54 · answer #4 · answered by clueless 1 · 0 0

example
i=0;
case 1;
i++; // first the value of i is increamented and then assigned to i
case 2;
++i; //its first assigned and then increamented

2006-06-18 11:06:06 · answer #5 · answered by vigneshn 2 · 0 0

pre is always before and post is always after if that helps any.

2006-06-18 11:03:48 · answer #6 · answered by christina b 2 · 0 0

fedest.com, questions and answers