Linked Questions

17 questions linked to/from javascript - How to make this code work?
3263 votes
45 answers
490k views

var funcs = []; // let's create 3 functions for (var i = 0; i < 3; i++) { // and store them in funcs funcs[i] = function() { // each should log its value. console.log("My value:", i); ...
nickf's user avatar
  • 548k
4 votes
4 answers
33k views

I am stuck at a point.There are 10 straight lines(png image).What I want is after the first line rotates by 40 deg,then the second line should start its rotaion and then the third,fourth,fifth and so ...
user avatar
1 vote
6 answers
6k views

I've been programming in JS since some time, but I have never came upon a need of using immediate functions, for example: (function(){ console.log('hello, I am an immediate function'); }()) What ...
ducin's user avatar
  • 26.6k
1 vote
3 answers
8k views

Demo <table id="tableStudent" border="1"> <thead> <tr><th>ID</th><th>Name</th> <th>Class</th></tr> </...
ND's's user avatar
  • 2,257
1 vote
2 answers
604 views

From what i know, a function say A defined within another function say B has access to local variables of B as well. function B() { var x = 10; function A() { console.log(x); //...
wallop's user avatar
  • 2,601
0 votes
1 answer
1k views

I know this is fairly straight forward using jQuery but for college assignment need to insert new paragraphs on clicking more link then remove them on clicking less links - we are not to use css or ...
user2464423's user avatar
4 votes
2 answers
542 views

If I do the following (in the global scope): var myObject = {name: "Bob"}; I have a way to point to that object in memory (i.e. the string identifier "myObject)". I can open the console and type: ...
Matt Harrison's user avatar
2 votes
3 answers
737 views

I'm trying to dynamically create function when iterating over an array and I need the arguments in the array to be set according to the value of the current index. For example: var array = ['apple',...
BarakChamo's user avatar
  • 3,595
0 votes
1 answer
974 views

i have this two recursive functions in javascript. first function returns digits of the input number in right to left order second function returns them in left to right order. function first(n){ ...
3 votes
3 answers
191 views

I've seen experts using below to declare a function: (function () { function f(n) { // Format integers to have at least two digits. return n < 10 ? '0' + n : n; } //etc }()...
Nil Pun's user avatar
  • 17.4k
1 vote
3 answers
127 views

function init(list) { var result = []; for (var i = 0; i<list.length; i++) { var item = 'item' + list[i]; result.push( function() { alert( item + ' ' +list[i] ) } ); } ...
rolz's user avatar
  • 80
1 vote
1 answer
97 views

I'm using a 3rd party javascript library which requires a nested array to be passed to a function. I'm using this function several times, and so storing the array in a variable and passing it to the ...
ChrisW's user avatar
  • 5,092
-4 votes
3 answers
132 views

I have 3 objects in an array. myArray = [ {name: "iPhone", link: "www.apple.com"}, {name: "Nokia", link: "www.nokia.com"}, {name: "Google", link: "www.Google.com"} ] How to make a loop and put ...
0 votes
1 answer
80 views

I've seen many questions for that context, but I still can't figure out, what exactly my Problem is. (I'm still experimenting with JavaScript, especially with objects) Code: function Field(val) { ...
0 votes
2 answers
82 views

I want to use a variable inside another function but is not defined! I tried it with this and var. how can I make it defined in another function? in the code below, I want to add actionInt by 1 in "...
user2781855's user avatar

15 30 50 per page
1
2