about summary refs log tree commit diff
path: root/usth/ICT3.2/prac/2/9.js
diff options
context:
space:
mode:
Diffstat (limited to 'usth/ICT3.2/prac/2/9.js')
-rw-r--r--usth/ICT3.2/prac/2/9.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/usth/ICT3.2/prac/2/9.js b/usth/ICT3.2/prac/2/9.js
new file mode 100644
index 0000000..628b9b4
--- /dev/null
+++ b/usth/ICT3.2/prac/2/9.js
@@ -0,0 +1,9 @@
+function second(a) {
+    let b = [...a].sort();
+    return [b[1], b[b.length-2]];
+}
+
+if (!module.parent) {
+    let [min, max] = second(process.argv.slice(2));
+    console.log(`${min} and ${max}`);
+}