Ali Nouman
This is a site slogan
  • Twitter
  • Linkedin
  • Home
  • About Me
  • Blog
  • Portfolio
  • Contact Me
  • Home

Es 6 Trick to Swap values between two variables | Javascript to Swap values between two variables

15 Oct

Es 6 Trick to Swap values between two variables | Javascript to Swap values between two variables

By alinouman es6, javascript 0 Comments
You can use following trick to swap values between two variables in es6.
let a = 5;
let b = 10;
[a,b] = [b,a]; // a = 10 b = 15

Share this post

Author

alinouman's picture

alinouman

Categories

  • .htaccess
  • ajax
  • angular
  • arrays
  • babel
  • Popular
  • Recent
  • Generators in Es6
    Sep 16, 2016
  • Ajax in React
    Dec 15, 2016
  • Array Matching in Javscript
    Sep 19, 2016
  • Writing Custom Callback for ajax
    Feb 15, 2017
  • Anonymous function assigned to variable vs a named function.
    Feb 04, 2017
  • Check if object value exists and set new value for object key | Code optimization
    Feb 01, 2017
Get In Touch

Newsletter

Keep up on our always evolving product features and technology. Enter your e-mail and subscribe to our newsletter.

Contact Me

  • Skype: ali.nouman92

  • Email: [email protected]

Follow Me

  • Twitter
  • Linkedin

© Copyright 2020 by Ali Nouman

  • Contact