How appropriate is humor in marketing?

Lately I often come across posts from companies with jokes and humor in general. Like a silly meme or something. Personally, I love it, but is it's working strategy in general?