WhatsApp online status for strangers
Being online can't be hidden as long as the person is not blocked. But you can choose who can see your last seen at information at

Whatsapp -> Top right "three dot" menu -> Settings -> Account -> Privacy -> Last seen