Gunnar Bittersmann: delete from Array

Beitrag lesen

@@dedlfix

arr = arr.filter(e => e != 'bar');

Nicht dass ich dir jetzt deinen Pluspunkt aberkennen möchte, aber was heißt arr und e?

Sprechende Variablennamen sind sprechend:

array = array.filter(element => element != 'bar');

😷 LLAP

--
“When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down ‘happy.’ They told me I didn’t understand the assignment, and I told them they didn’t understand life.” —John Lennon