codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Follow publication

JavaScript Increment ++ and Decrement --

Brandon Morelli
codeburst
Published in
2 min readDec 12, 2017

Image via unsplash.com

Increment & Decrement

Syntax

// Incrementlet a = 1;
a++;
++a;
// Decrement
let b = 1;
b--;
--b;

Using ++/-- After the Operand

// Incrementlet a = 1;console.log(a++);    // 1
console.log(a); // 2
// Decrementlet b = 1;console.log(b--); // 1
console.log(b); // 0

Using ++/-- Before the Operand

// Incrementlet a = 1;console.log(++a);    // 2
console.log(a); // 2
// Decrementlet b = 1;console.log(--b); // 0
console.log(b); // 0

Closing Notes:

If this post was helpful, please click the clap 👏button below a few times to show your support! ⬇⬇

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Published in codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Written by Brandon Morelli

Creator of @codeburstio — Frequently posting web development tutorials & articles. Follow me on Twitter too: @BrandonMorelli

Responses (13)

Write a response