From 651befc638c970cde6998efd6fedc3035d60713a Mon Sep 17 00:00:00 2001 From: iBug Date: Mon, 10 Feb 2020 16:35:56 +0800 Subject: [PATCH] Use Array.prototype.map() --- code.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code.js b/code.js index 92f970c..01230b6 100644 --- a/code.js +++ b/code.js @@ -2,9 +2,8 @@ // Time: @@TIME@@ function belongsToSubnet(host, list) { - var ip = host.split("."); - ip = 0x1000000 * Number(ip[0]) + 0x10000 * Number(ip[1]) + - 0x100 * Number(ip[2]) + Number(ip[3]); + var ip = host.split(".").map(Number); + ip = 0x1000000 * ip[0] + 0x10000 * ip[1] + 0x100 * ip[2] + ip[3]; if (ip < list[0][0]) return false;