Linked Questions

20 questions linked to/from JavaScript Loops: for...in vs for
0 votes
1 answer
857 views

Why do I get numbers (0 through 9) for trying to print each character in the string? The string's length is 10 so am I getting the index of each letter? How can I get the characters instead? I would ...
25 votes
4 answers
27k views

I was clustering around 40000 points using kmean algorithm. In the first version of the program I wrote the euclidean distance function like this var euclideanDistance = function( p1, p2 ) { // p1....
Josnidhin's user avatar
  • 12.5k
7 votes
1 answer
44k views

My understanding is that for...in loops are designed to iterate over objects in Javascript. See this post and this post. Take the following example. This returns 'Uncaught TypeError: items is not ...
1 vote
6 answers
16k views

I just want to ask if the in_array_orig and in_array_new is just the same. and also im confused on the result when comparing both array (aArr1 vs aArr2). can someone explain me. thanks Here is my ...
4 votes
1 answer
5k views

I have got an array from which some items are going to be removed; but some loops are still running on them, so I want to simply skip the places where I remove my objects I know that the syntax for(i ...
0 votes
4 answers
283 views

This has bothered me for a while, see my jsfiddle: http://jsfiddle.net/DHR8Q/, which contains the following javascript code: var id = "11111;22222;33333"; id = id.split(";"); alert(typeof id); for ...
3 votes
3 answers
3k views

I think there must be a question like this before but current search engines cannot give you results to queries of code lines. My question is: What's the difference between for ( var i = 0; i <...
3 votes
2 answers
3k views

Hoping someone can help me overcome my Javascript ignorance. I've got a form that includes checkboxes and I've got a piece of JS that toggles selecting/deselecting all the boxes. And so far, it all ...
Stace's user avatar
  • 147
0 votes
3 answers
2k views

the difference (speed, performace, side effects, ...) between implementations of the for loop: between var i; for(i = 0; i < length; i++){ //Do something} // more code and for(var i = 0; i < ...
0 votes
3 answers
351 views

I have the following js script. It uses alert to count the days of the week day 0 Monday ... day 6 Saturday. i starts with 0 since this is js. <script> var days = ['Sun', 'Mon', 'Tues', 'Wed',...
1 vote
4 answers
301 views

Apology: I apologize if this is a really basic question, I've looked around but since I never did get a very solid grounding in Javascript objects, I may be looking for answers in all the wrong ...
Matthew_Sp's user avatar
1 vote
5 answers
237 views

Here is some sample code of what I am trying to achieve: pingpong = { paddleA: { speed: 5, }, paddleB: { speed: 6, }, paddleAI: { AI1: "paddleA", ...
rshea0's user avatar
  • 12.3k
2 votes
3 answers
111 views

I'm new to javascript and simply trying to pull links from a webpage so I'm doing the following: for(link in document.links) { console.log(link.getAttribute("href"); } But if I do this: document....
0 votes
2 answers
316 views

I have a question in a form asking if you've used alcohol, drugs, both, neither, "777", "999". alcohol : question 2; drugs : question 3; both : questions 2 + 3; neither or "777" or "999" : question ...
0 votes
0 answers
246 views

the code below cannot run properly on Google Chrome : var e, divStyle = { backgroundColor: "rgba(153, 153, 153, 0.29)", postion: "fixed", top: 0, left: 0, ...

15 30 50 per page
1
2