aboutsummaryrefslogtreecommitdiff
path: root/challenge-119
diff options
context:
space:
mode:
authordrbaggy <js5@sanger.ac.uk>2021-06-29 08:33:25 +0100
committerdrbaggy <js5@sanger.ac.uk>2021-06-29 08:33:25 +0100
commitefb84da018cae092ec9386f47b930a17903a5da0 (patch)
treef5c9476483d407087faa3c431111de63c53e8c38 /challenge-119
parent2ace3148f63589730dce28d391049eccbd8054ff (diff)
downloadperlweeklychallenge-club-efb84da018cae092ec9386f47b930a17903a5da0.tar.gz
perlweeklychallenge-club-efb84da018cae092ec9386f47b930a17903a5da0.tar.bz2
perlweeklychallenge-club-efb84da018cae092ec9386f47b930a17903a5da0.zip
js version
Diffstat (limited to 'challenge-119')
-rw-r--r--challenge-119/james-smith/javascript/ch-1.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/challenge-119/james-smith/javascript/ch-1.js b/challenge-119/james-smith/javascript/ch-1.js
new file mode 100644
index 0000000000..4608fb09a1
--- /dev/null
+++ b/challenge-119/james-smith/javascript/ch-1.js
@@ -0,0 +1,9 @@
+TESTS = [ [101,86],[18,33] ];
+
+TESTS.forEach(_ => console.log( swap_nibble( _[0] ) == _[1] ? 'OK' : '--' ) );
+TESTS.forEach(_ => console.log( swap_nibble( _[1] ) == _[0] ? 'OK' : '--' ) );
+
+function swap_nibble(_) {
+ return (_>>4) | ((_&15)<<4);
+}
+