ES6 Exercise #1: JavaScript Program to Swap Two Numbers without using Third Variable? #Interview

preview_player
Показать описание


***************** MUST WATCH VIDEOS ******************

************* Must Watch Videos For Web Development.*************

Make Website Responsive Using Media Queries in One Video in Hindi | Web Design Tutorial in Hindi

Believe me, all this money will be used to make more quality videos and to make my channel grow. So that I can always provide you awesome free videos :)

Guys, Please support my channel by SUBSCRIBE to my channel and share my videos in your Social Network TimeLines.

Don't Forget to Follow me on all Social Network,

Рекомендации по теме
Комментарии
Автор

In old ec,
a = a+b
b=a-b
a=a-b
And values are swipped. But new ec made it very simple.

sudhir_devkar
Автор

Thank you dai sarai ramro sikhaunu huncha 😘

examtak
Автор

We can also..perform this by both two
a=a+b;
b=a-b;
a=a-b;
document.write(a+", "+b);

kirtisharma
Автор

great work bro we need more problem solving question thanks

shubhamsingh
Автор

<script>
let a=10;
let b=5;
a=a+b;
b=a-b;
a=a-b;
alert(`after swapping value will be a : ${a} and value of b : ${b}`);

</script>

singh
Автор

Great Work Mr. Thapa...We need more people like you who shares knowledge free of cost... (Eg: b = (b = a + (a=b))-a;) this logic works with other languages also:)

bishaldutta
Автор

it's very useful while using implementing data structure

zafarhussain
Автор

var a = 1;
var b = 3;

[a, b] = [b, a];
console.log(a); // 3
console.log(b); // 1

fuzailakhtar
Автор

let a=8;
let b=4;

a=a+b;
b=a-b;
a=a-b;

console.log(a);
console.log(b);

vinaydixit
Автор

Var a=5;
Var b=10;
a=b; b=a;

Also works

hamadjan
Автор

let a = 10;
let b = 20;

[a, b] = [b, a]

console.log(`value of a is: ${a}`)
console.log(`value of b is: ${b}`)

ahmednisar
Автор

A =5;
B =3;
A = A ^ B;
B = A ^ B;
A = A ^ B;

RitikKumar-bkpj
Автор

let a = [10];
let b = [20];

[a, b] = [b, a];
console.log(`value of a = ${a} and value of b = ${b}`);

output :-

value of a = 20 and value of b = 10

jayprajput
Автор

Could not find Array Destructure video,

praveenkrgola
Автор

let x = 20;
let y = 30;
console.log(`Value of x is ${x} and y is ${y}.`);
console.log(`Swap value of x is ${(x+y)-x} and y is ${(x+y)-y}`);

pallavraj
Автор

React par video banao sir please ek project bana do🙏🙏

sunilmalakar
Автор

[a, b]=[b, a] tough to understand, plz explain how store values

susandanne
Автор

Mai isi tarah or questions chahta hu.arrray ko sum kese kre avg kese nikale DSA k or questions with solution video bnao....

rajeevyadav-npfg
Автор

i want to print it on browser not in console so what i have to wrtie

udittiwari
Автор

Maine solve kiya h lakin aapke jaise nhi
C++ me yeh trick Kamm karega kya ?
Osm✌🏻

DEEPANSHU_NAG