Bottom of this page.
|
<<last
0
1
2
-
e052b308
anonymous
2022-08-16 12:19
- JacaScriptとかにおいて、
switch(chr){
case '<': xxx; break;
case '>': yyy; break;
default: zzz;
}
と、
const sDefault=new Symbol("default");
const commands=new Map([
['<', function(){xxx;}],
['>', function(){yyy;}],
[sDefault, function(){zzz;}]
]);
commands.has(chr)?
commands.get(chr)():
commands.get(sDefault)();
ってどちらが読みやすくてメンテしやすそうなんだろう?それ以外に特徴とかあるのだろうか?
Top of this page.
|
<<last
0
1
2
(プログラミング/149/0.0MB)