Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #24585
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2014-06-02 16:44 -0700 |
| Message-ID | <3206f477-4226-48fb-84d5-bfb012f0271a@googlegroups.com> (permalink) |
| Subject | Code Exercise, good for newbies! |
| From | dhtml <dhtmlkitchen@gmail.com> |
Write a function removeItem to remove a specified item from array.
function f(){}
var a = [1, "bird", f];
var b = [2, "dog", null];
removeItem(a, f); // expect a as [1, "bird"]
removeItem(b, "dog"); // expect b as [2, null]
function removeItem(array, item) {
// Your code goes here.
}
Using the following Array methods:
indexOf(o) -- added in ES5 (EcmaScript 5)
splice(start, deleteCount, insertItems);
Where possible, test in Internet Explorer back to version 8. Use
developer tools to switch IE version in IE. If you don't know how, do
a web search: switch version of IE developer tools
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
Code Exercise, good for newbies! dhtml <dhtmlkitchen@gmail.com> - 2014-06-02 16:44 -0700 Re: Code Exercise, good for newbies! Scott Sauyet <scott.sauyet@gmail.com> - 2014-06-03 13:28 -0700
csiph-web