From 7959b9bcea6d925d3cf10a3fd2bd7019e4f18756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20Soko=C5=82owski?= Date: Tue, 13 Apr 2021 00:16:53 +0200 Subject: [PATCH] tsp weight working --- src/services/playground2.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/services/playground2.js diff --git a/src/services/playground2.js b/src/services/playground2.js new file mode 100644 index 0000000..ad56039 --- /dev/null +++ b/src/services/playground2.js @@ -0,0 +1,19 @@ +var predicates = { + '==': function (a, b) { + return a === b; + }, + '>=': function (a, b) { + return a >= b; + }, + '<': function (a, b, item) { + return item[a] < item[b]; + }, +}; +let p = predicates['<']; +let item = { + a: 1, + b: 2, +}; +console.log(item['a'], item['b']); +console.log(item['a'] < item['b']); +console.log(p('a', 'b', item));