|
var d = [ |
|
{ |
|
id:"2", |
|
num:"2", |
|
c:20 |
|
}, |
|
{ |
|
id:"4", |
|
num:"4", |
|
c:50 |
|
}, |
|
{ |
|
id:"3", |
|
num:"4", |
|
c:70 |
|
} |
|
] |
|
var fs = require("fs-extra"); |
|
var path = __dirname+"/d.json"; |
|
var d3 = JSON.parse(fs.readFileSync(path,"utf-8")); |
|
|
|
|
|
|
|
|
|
var s = 4; |
|
async function check() { |
|
for (let i of d3) |
|
{ |
|
if (i.num == s) { |
|
var f = d3.find(item => item.num == s); |
|
|
|
console.log("đã thưởng",i.c*2,"$") |
|
} |
|
|
|
|
|
} |
|
|
|
|
|
d3 = d3.filter(ie => ie.num != s); |
|
console.log(d3) |
|
fs.writeFileSync(path,JSON.stringify(d3,null,4),"utf8") |
|
} |
|
console.log(" số của bạn là 139392\n kết quả sổ xố hôm nay là 392293\n bạn trúng",countd(139392,392293),"số\n mỗi số giá 20k => 20*6 = 120k, bạn lỗ :)") |
|
|
|
|
|
|
|
|
|
function countd(N,M) |
|
{ |
|
|
|
var count = 0; |
|
|
|
var freq1 = Array(10).fill(0); |
|
|
|
var freq2 = Array(10).fill(0); |
|
|
|
while (N > 0) { |
|
|
|
|
|
|
|
freq1[N % 10]++; |
|
|
|
N = Math.floor(N / 10); |
|
} |
|
|
|
while (M > 0) { |
|
freq2[M % 10]++; |
|
M = Math.floor(M / 10); |
|
} |
|
var i; |
|
for (i = 0; i < 10; i++) { |
|
|
|
if (freq1[i] > 0 & freq2[i] > 0) { |
|
count++; |
|
} |
|
} |
|
return count; |
|
} |
|
|