Author: Not specified Language: javascript
Description: Not specified Timestamp: 2018-04-17 08:35:57 +0000
View raw paste Reply
  1. var sample = [1, 2, 3] // yeah same array
  2. // es5
  3. var result = sample.filter(function(elem){
  4.     return elem !== 2;
  5. })
  6. console.log(result)
  7. // es6
  8. var result = sample.filter(elem => elem !== 2)
  9. /* output */
  10. [1, 3]
View raw paste Reply