The search function in the following code is not working and I believe it has something to do with the For...In loop but I am new to JS and unsure why:  var friends = { bill: {     firstName: "bill",     lastName: "smith",     number:...
Last night, I got really bored and I thought of a little idea for a little script. Basically I was thinking about how many built-in functions PHP has compared to JavaScript and then I realized that I really don't know how many functions JavaScrip...
I need to set the value of every item in this array, counting up.  So, for example, path[0].value = 1, path[1].value = 2 etc...  EDIT: I'm looking for the most efficient way to do this.  I think a for loop is the best way, but I want to learn oth...
I'd like to add an "insert" method on Arrays. So I'm doing it like this:  > Array.prototype.insert = function(index, element){     this.splice(index, 0, element); };   And it works:  > a = [1,2,3] [1, 2, 3] > a.insert(0, 4) u...
So I'm a JS newbie and am trying to figure out how to fix my problem. I am trying to loop over an object and return the lowest number.  in my var shortest = ; if I hardcode a number say var shortest = 455; then the problem returns the correct num...
I'm trying to figure out how to add an itertor to a javascript class such that the class could be used in a for...in loop. Following the instructions from Mozilla doesn't produce the results they claim it will. https://developer.mozilla.org/e...
What is the difference between for..in and for each..in statements in javascript? Are there subtle difference that I don't know of or is it the same and every browser has a different name for it?...
I'm working on a JS to show different messages depending on the current url's hash. Now, that's all working, but I was wondering what the best way would be to access my messages (They'll be coded into a .js file)  At the moment, I hav...
I'm having trouble understanding the way this for in loop works.   function createSimpleNode(name, options, text) {          var node = document.createElement(name);           for (var o in options) {                   node.setAttribute(o, option...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.