xmlhttprequest(build5381)
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.
(#14451760@0)
Last Updated: 2022-3-19
This post has been archived. It cannot be replied.
Replies, comments and Discussions:
-
工作学习 / 学科技术 / how to swap two values in .net? for example int a, int b, how to swap the value of them?
-binghongcha76(一只大猫);
2022-3-18
{103}
(#14451430@0)
老方法是借助一个临时变量 c
C# 7以后引入了一个新的语法
(a,b) = (b,a);
ya easy..
-
Any use cases of switching values of two variables?
-sailor(Ocean & Mountain);
2022-3-18
(#14451564@0)
-
好问题,吃饱了撑的😂而且不管你表面怎么简化,机器内部还是要通过第三个变量去做,整数之类的小东西没啥,物体数列之类的大东西最好写在面上,省得被忽略。
-piglet(小猪);
2022-3-19
(#14451572@0)
-
I don't remember that I ever needed to do such switching.
-sailor(Ocean & Mountain);
2022-3-19
(#14451574@0)
-
前面写错了,后面想改回去? 😂
-piglet(小猪);
2022-3-19
(#14451578@0)
-
刷题时天天 swap two variables lol
-xmlhttprequest(build5381);
2022-3-19
(#14451585@0)
-
很常见啊。比如quicksort里就需要用到
-iamflying(叶和花);
2022-3-19
(#14451586@0)
-
theArray.sort()😆
-sailor(Ocean & Mountain);
2022-3-19
(#14451755@0)
-
Quick select也需要:找出第n大的数。
-iamflying(叶和花);
2022-3-19
(#14453466@0)
-
如果加减不溢出,可以不需要临时变量:
-iamflying(叶和花);
2022-3-19
{42}
(#14451588@0)
-
不好。不易懂,难维护。主贴的意思是将来的编程应该这样: swap(a,b)
-big-foot-is-a-joke(big-foot-is-a-joke);
2022-3-19
(#14451682@0)
-
a,b的type不一定是int,可以是任意 T a, T b, (a,b)=(b,a) 是 Tuple<>的一个语法糖
-binghongcha76(一只大猫);
2022-3-19
(#14451749@0)
-
在 js 里通过 destructuring expression,看上去很类似,不过 js array destructuring 超实用... 个人觉得 c# / es6+ 是最简练,最优雅的... 不过c#最近的版本有一些 features 有点为语法糖而语法糖了...
-xmlhttprequest(build5381);
2022-3-19
{810}
(#14451760@0)
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.