Skip to primary content

"My brain is my enemy" …

czyli techniczne dyrdymały

"My brain is my enemy" …

Main menu

  • Home
  • Dlaczego tak?
  • Node.js
    • Ciekawe projekty node.js
    • node.js addons

Post navigation

← Previous Next →

JavaScript array remove element

Posted on May 15, 2011 by Aleksander Cynarski

Szybkie kasowanie elementu jak nie znamy indexu elementu.
Szybko i na temat:

Array.prototype.remove=function(s){
   var i = this.indexOf(s);
   if(i != -1) this.splice(i, 1);
}

Wykorzystanie:

jakisarray.remove('wartosc');

Udostępnij:

  • Facebook
  • Twitter
  • Email

Related

This entry was posted in JavaScript by Aleksander Cynarski. Bookmark the permalink.
Proudly powered by WordPress
This blog is protected by Dave's Spam Karma 2: 24125 Spams eaten and counting...
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.