I have 2 numbers and I would like to compare them. If all number B appears in A = true else = false
I've tried this but it's still returning True when B has a number that doesn't exist in A
if (A >= B)
return true
else
return false
ex:
A = 98765
B = 8759
A >= B // True
A = 154
B = 154
A >= B // True
A = 875
B = 8756
A >= B // False
A = 1111
B = 112
A >= B //output: True // expected output: False because don't have 2 in A
You may do the following steps:
toString()
.split('')
B
if it is included in the characters of A
const aChars = A.toString().split('')
const bChars = B.toString().split('')
return bChars.every(c => aChars.includes(c))