Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
26
Task/Sort-three-variables/JavaScript/sort-three-variables.js
Normal file
26
Task/Sort-three-variables/JavaScript/sort-three-variables.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
const printThree = (note, [a, b, c], [a1, b1, c1]) => {
|
||||
console.log(`${note}
|
||||
${a} is: ${a1}
|
||||
${b} is: ${b1}
|
||||
${c} is: ${c1}
|
||||
`);
|
||||
};
|
||||
const sortThree = () => {
|
||||
|
||||
let a = 'lions, tigers, and';
|
||||
let b = 'bears, oh my!';
|
||||
let c = '(from the "Wizard of OZ")';
|
||||
printThree('Before Sorting', ['a', 'b', 'c'], [a, b, c]);
|
||||
|
||||
[a, b, c] = [a, b, c].sort();
|
||||
printThree('After Sorting', ['a', 'b', 'c'], [a, b, c]);
|
||||
|
||||
let x = 77444;
|
||||
let y = -12;
|
||||
let z = 0;
|
||||
printThree('Before Sorting', ['x', 'y', 'z'], [x, y, z]);
|
||||
|
||||
[x, y, z] = [x, y, z].sort();
|
||||
printThree('After Sorting', ['x', 'y', 'z'], [x, y, z]);
|
||||
};
|
||||
sortThree();
|
||||
Loading…
Add table
Add a link
Reference in a new issue