Javascript:如何从字符串末尾删除字符?

Alb*_*ert 95 javascript string

我有一个字符串"foo_bar""foo_foo_bar".如何"_bar"从字符串中删除最后一个?所以我留下了"foo"和"foo_foo".