On Feb 29, 2016 7:11 AM, <jonas.thornv...@gmail.com> wrote:
>
> Sorry but would not if (array==empty) suffice and be alot clearer?

In Python, you can just do "if len(array) == 0" or "if not array".

In JavaScript you have "if (array.length === 0)". Is there some problem
with that?

I would prefer this over your suggestion since it doesn't require some
variable named "empty" to have a sensible value set.

On the container test, as others pointed out, Python has the "in" operator.
JavaScript has a draft Array.prototype.includes method, but it doesn't have
broad cross-browser support yet.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to