Комментарии:
temp is also be a variable.
ОтветитьFabulous
Ответить✌️love u bhai❤
Ответитьlet a = 10;
let b = 20;
[a , b] = [b, a]
console.log(`value of a is: ${a}`)
console.log(`value of b is: ${b}`)
a = a + b
b = a - b
a = a - b
its amazing
Ответитьlet a = 5
let b = 10
[a,b]=[b,a];
console.log(`c = ${a}, d = ${b}`);
this wont work for me i got this error :
index.html:4 Uncaught ReferenceError: Cannot access 'b' before initialization
at index.html:3:8
A =5;
B =3;
A = A ^ B;
B = A ^ B;
A = A ^ B;
[a,b]=[b,a]
Ответить3 number ko kese swap kere 🙂🙂🤔🤔
ОтветитьThank you dai sarai ramro sikhaunu huncha 😘
Ответитьb=b-a and a=a+b
Ответитьa=a+b
b=a-b
a=a-b
a=a+b;
b=a-b;
a=b+b;
this is the logic
jo bata raha hai proper bata har baat pe previous video ka advertise mat Karo ek video dekh rahe to bologe ye dekhne ke liye wo dekho wo dekhne ke liye yo dekho what is this.
ОтветитьCould not find Array Destructure video,
Ответитьthank you so much sir
Ответитьit's very useful while using implementing data structure
Ответитьsolution
let [a,b] = [b,a];
Awesome
ОтветитьBOOM
Ответитьsuper
ОтветитьWe can also..perform this by both two variables.....
a=a+b;
b=a-b;
a=a-b;
document.write(a+" ,"+b);
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}`);
<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>
var a = 1;
var b = 3;
[a, b] = [b, a];
console.log(a); // 3
console.log(b); // 1
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
Var a=5;
Var b=10;
a=b; b=a;
Also works
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:)
Ответитьlet a =5;
let b =10;
console.log(`Before swapping, a =${a} \n b = ${b}`)
console.log(`After swapping swapping, b =${b = b-a} \n a = ${b+a}`)
U r awesomr
Ответитьthe tutorial is very awesome.
Ответить[a=10, b=5]
Ответитьlet a=8;
let b=4;
a=a+b;
b=a-b;
a=a-b;
console.log(a);
console.log(b);
i want to print it on browser not in console so what i have to wrtie
Ответитьlet a=2 ; b=3;
if(true){const b=a; console.log(b);}
console.log(`${a=b}`); ....
Awesome
ОтветитьIn old ec,
a = a+b
b=a-b
a=a-b
And values are swipped. But new ec made it very simple.
[a,b]=[b,a] tough to understand,plz explain how store values
ОтветитьLots of thanks
Ответитьnice destructuring concept :)
ОтветитьSir plz php or wardpress par video banaia
ОтветитьReact par video banao sir please ek project bana do🙏🙏
ОтветитьReact js par video banao sir
ОтветитьHello Bhai Ap ek video upload karna angular 8 one video upload karna plz bhai Step by step beginner
ОтветитьSir G,,,,
Koi Aisi Template Banaye Jis Me Backend Se Koi Cheez Upload Kar Sake!!!!!!
Plz G?????