https://learn.javascript.ru/task/remove-class

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
var removeClass = function(obj, cls) {
var mas = obj.className.split(' ');
if (mas.indexOf(cls) != -1) {
var a = mas.indexOf(cls);
mas.splice(a, 1);
}
obj.className = mas.join(' ');
};
var obj = {
className: 'my menu menu'
};
removeClass(obj, 'menu');
alert(obj.className);