Home javascript What is postinrement and preposrerent?

What is postinrement and preposrerent?




I study JavaScript and PHP, but I do not understand completely such moments as post-creasent and preposrerent. Explain if not difficult.

Answer 1, Authority 100%

a = ++ i = & gt; i = i + 1
     A = I.
a = i ++ = & gt; A = I.
     i = i + 1

Answer 2, Authority 75%

Increment: Widense Operation (increment) in C Similar languages ​​usually per unit (Operator ++ )
Decreen: Reduction operation in c such languages ​​are usually per unit (Operator - )

++ i;

First performs increment and then returns the result:

var i = 2;
Alert (++ i); // displays 3.

And postinrement:

i ++;

first returns the result and then performs increment:

var i = 2;
Alert (I ++); // displays 2.
// and now i = 3;

Dear @ Reyuzaki2 As I understand it from your comment on the answer @aramcpp You do not even know the basics of JavaScript, I advise you to go and read:
1) on javascript.ru
2) Especially here: Basic Operators JavaScript

So that your questions no longer happened 🙂

Answer 3, Authority 25%

Precrement has the highest priority.
For example, there is a code A [++ i] = 5 ,
That first is incremented, then assigned.
And so A [I ++] = 5
Assigns, then incrementated.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions