Click here to Skip to main content
15,885,890 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Question of a dusy_dex Pin
Hakan Bulut16-Apr-13 2:42
Hakan Bulut16-Apr-13 2:42 
GeneralRe: Question of a dusy_dex Pin
dusty_dex16-Apr-13 6:35
dusty_dex16-Apr-13 6:35 
GeneralRe: Question of a dusy_dex Pin
Hakan Bulut17-Apr-13 1:57
Hakan Bulut17-Apr-13 1:57 
GeneralRe: Question of a dusy_dex Pin
dusty_dex17-Apr-13 4:56
dusty_dex17-Apr-13 4:56 
GeneralRe: Question of a dusy_dex Pin
dusty_dex15-Apr-13 23:41
dusty_dex15-Apr-13 23:41 
GeneralRe: Question of a dusy_dex Pin
Hakan Bulut16-Apr-13 2:05
Hakan Bulut16-Apr-13 2:05 
GeneralRe: Question of a dusy_dex Pin
dusty_dex16-Apr-13 2:15
dusty_dex16-Apr-13 2:15 
GeneralRe: Question of a dusy_dex Pin
dusty_dex16-Apr-13 9:37
dusty_dex16-Apr-13 9:37 
I have left the arrLot array alone for now. But this is my guess at what your code needs to be.
Basically I convert arrIns array to one big string, then compare sub-strings with i. If the value of i isn't found then arr[ ] = i

JavaScript
// **NEW** add leading zero to numbers < 10
function zeroAdjust(n) {
    var t = "0"+n;
    return t.substring(t.length-2,t.length);
}

// these also need leading zero if < 10
var arrIns  = [ "01","21","24","28","42","48",
                "12","23","34","36","37","46",
                "03","18","19","25","44","45"  ];

var allLucky = arrIns.toString();

var arrLot  = [];
var arr     = [];
var count   = 0;
var t;
for(var i=1; i<50; i++)
  {
    // force i to string then
    // compare i with all lucky numbers
    if (allLucky.indexOf(zeroAdjust(i)) == -1 ) {
      arr[count] = i; // add +"" 
      count++;
    }
  } // for-loop

document.write("length of arr[] ="+ count +"<br>");


I have provided this just to help you move forward (if my guess was correct)

here are some more bits of code for you to look at.
csv = comma,separated,values which is what you get with an array.toString() call. Smile | :)

JavaScript
//==========  EXAMPLE  ===============
// Save & Restore an array
var arrIns  = [ "01","21","24","28","42","48",
                "12","23","34","36","37","46",
                "03","18","19","25","44","45"  ];

var arr_to_csv   = arrIns.toString();
document.write(arr_to_csv);

var arr_from_csv = [];
var tmp = arr_to_csv.split(",");

for (var i=0; i < tmp.length; i++) {
    arr_from_csv[i] = parseInt( tmp[i]);
    document.write(arr_from_csv[i]);
}
//====================================


The following code has arrIns as a N-dimensional array (3x6) of numbers, but it would complicate the code for comparisons, like the allLucky string compare above.

JavaScript
//==========  EXAMPLE  ===============
// arrIns array of 3 x 6 (not "strings")
var arrIns  = [ [ 1,21,24,28,42,48],
                [12,23,34,36,37,46],
                [ 3,18,19,25,44,45]
              ];

document.write("lucky numbers, one week at a time<br>");
for (var week=1; week < 4; week++) {
  document.write("week no: "+ week +"<br>");

  for (var i=0; i < 6; i++) {
     document.write(arrIns[week-1][i]);
  }
}
//==================================== 


Big Grin | :-D
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan

That's what machines are for.

Got a problem?
Sleep on it.


modified 16-Apr-13 17:35pm.

GeneralRe: Question of a dusy_dex Pin
dusty_dex16-Apr-13 10:53
dusty_dex16-Apr-13 10:53 
GeneralRe: Question of a dusy_dex Pin
Hakan Bulut16-Apr-13 21:18
Hakan Bulut16-Apr-13 21:18 
QuestionJavaScript controls with date and time (format: dd / mm / yyyy hh: mm: ss) Thank you, and provide the connection site Pin
Jandren10-Apr-13 16:59
Jandren10-Apr-13 16:59 
AnswerRe: JavaScript controls with date and time (format: dd / mm / yyyy hh: mm: ss) Thank you, and provide the connection site Pin
enhzflep10-Apr-13 18:36
enhzflep10-Apr-13 18:36 
QuestionHow can I submit form without the querystring Pin
jsampathkumar10-Apr-13 7:22
professionaljsampathkumar10-Apr-13 7:22 
AnswerRe: How can I submit form without the querystring Pin
Graham Breach10-Apr-13 7:55
Graham Breach10-Apr-13 7:55 
AnswerRe: How can I submit form without the querystring Pin
Sandeep Mewara10-Apr-13 8:16
mveSandeep Mewara10-Apr-13 8:16 
QuestionIE(10) has problems with SELECT.onchange Pin
captnmac8-Apr-13 7:22
captnmac8-Apr-13 7:22 
AnswerRe: IE(10) has problems with SELECT.onchange Pin
enhzflep10-Apr-13 9:19
enhzflep10-Apr-13 9:19 
GeneralRe: IE(10) has problems with SELECT.onchange Pin
captnmac11-Apr-13 1:54
captnmac11-Apr-13 1:54 
GeneralRe: IE(10) has problems with SELECT.onchange Pin
enhzflep11-Apr-13 2:25
enhzflep11-Apr-13 2:25 
AnswerRe: IE(10) has problems with SELECT.onchange Pin
Graham Breach11-Apr-13 2:56
Graham Breach11-Apr-13 2:56 
Questionhow can save a file through javascript Pin
vimal Tyagi Zindagi3-Apr-13 21:18
vimal Tyagi Zindagi3-Apr-13 21:18 
AnswerRe: how can save a file through javascript Pin
Sandeep Mewara3-Apr-13 23:30
mveSandeep Mewara3-Apr-13 23:30 
QuestionUsing a javascript timer in a asp User Control Pin
Steve Holdorf1-Apr-13 11:09
Steve Holdorf1-Apr-13 11:09 
AnswerRe: Using a javascript timer in a asp User Control Pin
Steve Holdorf2-Apr-13 0:46
Steve Holdorf2-Apr-13 0:46 
AnswerRe: Using a javascript timer in a asp User Control Pin
Steve Holdorf2-Apr-13 1:46
Steve Holdorf2-Apr-13 1:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.