That's not true for Java anymore -- see here.
As for Javascript, I couldn't find any articles that discuss this, but I highly doubt that instanceof would be cause any performance issues. If you need to use it, I would say go for it, and then reconsider only if you're running into performance problems.