Can you toggle multiple classes at once?

Question

In the context of this exercise, can you toggle multiple classes at once?

Answer

Yes, you can toggle multiple classes using a single .toggleClass() call. To do so, you can separate the class names with spaces.

For example,

$('item').toggleClass('class1 class2 class3');
4 Likes