Good morning gorgeous friends;
is there any equivalent of this python expression in javascript
l = [1, 2, 5, 4, 8]
n = 5
print('yeah' if n in l else 'no')
Thanks
We're a place where coders share, stay up-to-date and grow their careers.
Good morning gorgeous friends;
is there any equivalent of this python expression in javascript
l = [1, 2, 5, 4, 8]
n = 5
print('yeah' if n in l else 'no')
Thanks
Blessing Hirwa -
Rakesh -
Kinanee Samson -
Rizwan Hasan -
Discussion
EDIT: Never mind, the code below actually does something completely different. This is why I hate javascript ffs.
console.log(l.includes(n) ? 'yeah' : 'no');