JS Question
-
I was referring to this code. Or did you mean new sorting code?
"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.
sort code sample pls :)
Hakan cursed chats dealer
-
Can I recommend as well that you use something like http://jsfiddle.net/[^] because I honestly am not following what it is that you are trying to do.
as if the facebook, twitter and message boards weren't enough - blogged
JQuery I have no any knowledge about on this language..
Hakan cursed chats dealer
-
sort code sample pls :)
Hakan cursed chats dealer
Small change to previous code, see use of var t;
// **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++)
{
// compare t with all lucky numbers
t = zeroAdjust(i);
if (allLucky.indexOf(t) == -1 ) {
arr[count] = t; // arr[] = "nn"
count++;
}
} // for-loopdocument.write("arr[]:"+ arr.toString);
document.write("
");
document.write("length of arr[] ="+ count +"
");*NEW*
function sort(ref) {
var a = [];
var i;//== conversion function (only to sort) ========================================
function strToUcc( s ) {
if (s.length < 2) {
return String.fromCharCode(s.charCodeAt(0)-48);
} else {
return String.fromCharCode( (s.charCodeAt(1)-48)+((s.charCodeAt(0)-48)*10) );
}
}//== conversion function as "nn" string
function uccToStr( s ) {
var tmp = s.charCodeAt(0);
var lo = tmp % 10;
var hi = (tmp-lo) / 10;return String.fromCharCode(hi+48)+String.fromCharCode(lo+48);
}
//=================================================================================// char-code from "nn"
i=0;
while (i < ref.length) {
a[i] = strToUcc( ref[i] );
i++;
}a.sort(); // SORT
// back to "nn"
i=0;
while (i < ref.length) {
ref[i] = uccToStr( a[i] );
i++;
}} // fn-sort
sort(arrIns);
document.write("Sorted:"+ arrIns.toString());
"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.
-
Small change to previous code, see use of var t;
// **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++)
{
// compare t with all lucky numbers
t = zeroAdjust(i);
if (allLucky.indexOf(t) == -1 ) {
arr[count] = t; // arr[] = "nn"
count++;
}
} // for-loopdocument.write("arr[]:"+ arr.toString);
document.write("
");
document.write("length of arr[] ="+ count +"
");*NEW*
function sort(ref) {
var a = [];
var i;//== conversion function (only to sort) ========================================
function strToUcc( s ) {
if (s.length < 2) {
return String.fromCharCode(s.charCodeAt(0)-48);
} else {
return String.fromCharCode( (s.charCodeAt(1)-48)+((s.charCodeAt(0)-48)*10) );
}
}//== conversion function as "nn" string
function uccToStr( s ) {
var tmp = s.charCodeAt(0);
var lo = tmp % 10;
var hi = (tmp-lo) / 10;return String.fromCharCode(hi+48)+String.fromCharCode(lo+48);
}
//=================================================================================// char-code from "nn"
i=0;
while (i < ref.length) {
a[i] = strToUcc( ref[i] );
i++;
}a.sort(); // SORT
// back to "nn"
i=0;
while (i < ref.length) {
ref[i] = uccToStr( a[i] );
i++;
}} // fn-sort
sort(arrIns);
document.write("Sorted:"+ arrIns.toString());
"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.
var arrIns = [
"1","21","24","28","42","48",
"9","13","14","16","24","49",
"3","18","19","25","44","45"
];Was that I wanted to do exactly. These numbers are the numbers that are caught in the combination of more than one slip would like to add Forexmple 24 number is 2 winnig number. i want to print this numbers from inside this array..
Hakan cursed chats dealer :)
-
var arrIns = [
"1","21","24","28","42","48",
"9","13","14","16","24","49",
"3","18","19","25","44","45"
];Was that I wanted to do exactly. These numbers are the numbers that are caught in the combination of more than one slip would like to add Forexmple 24 number is 2 winnig number. i want to print this numbers from inside this array..
Hakan cursed chats dealer :)
Sorry I do not understand. :confused: try and explain by breaking up the problem, and show example of array before and after. Maybe I can work it out.
"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.
-
var arrIns = [
"1","21","24","28","42","48",
"9","13","14","16","24","49",
"3","18","19","25","44","45"
];Was that I wanted to do exactly. These numbers are the numbers that are caught in the combination of more than one slip would like to add Forexmple 24 number is 2 winnig number. i want to print this numbers from inside this array..
Hakan cursed chats dealer :)
Try adding this line inside the loop for(var i=1; i<50; i++) { // compare t with all lucky numbers t = zeroAdjust(i); if (allLucky.indexOf(t) == -1 ) { arr[count] = t; // arr[] = "nn" count++; }
if (allLucky.indexOf(t) != -1) document.write("Match: "+t);
} // for-loop If you need to collect all matched lucky numbers then you should create a new array: var matched = []; var m = 0; change that line to
if (allLucky.indexOf(t) != -1) {
matched[m] = t;
m++;
}"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.
-
Try adding this line inside the loop for(var i=1; i<50; i++) { // compare t with all lucky numbers t = zeroAdjust(i); if (allLucky.indexOf(t) == -1 ) { arr[count] = t; // arr[] = "nn" count++; }
if (allLucky.indexOf(t) != -1) document.write("Match: "+t);
} // for-loop If you need to collect all matched lucky numbers then you should create a new array: var matched = []; var m = 0; change that line to
if (allLucky.indexOf(t) != -1) {
matched[m] = t;
m++;
}"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.
I'm customer just now... If it does compare to 49 numbers of dimension so 1 adjust as match each one of numbers and it will no return encounter for the same numbers .. JavaScript is not skilled enough
Hakan cursed chats dealer :)
-
I'm customer just now... If it does compare to 49 numbers of dimension so 1 adjust as match each one of numbers and it will no return encounter for the same numbers .. JavaScript is not skilled enough
Hakan cursed chats dealer :)
If you are referring to C++ pointers then you are not going to get very far. If I understood problem better. I could work it out. You are not a very good communicator, it is not a problem with javascript. The problem is English to Turkish translation. But you are not giving enough feedback.
"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.
-
If you are referring to C++ pointers then you are not going to get very far. If I understood problem better. I could work it out. You are not a very good communicator, it is not a problem with javascript. The problem is English to Turkish translation. But you are not giving enough feedback.
"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.
I know this is possible with Reverse() but IE9.0 is not supported I have to thanks for everything
Hakan cursed chats dealer :)
-
I know this is possible with Reverse() but IE9.0 is not supported I have to thanks for everything
Hakan cursed chats dealer :)
If you are referring to array.reverse, then it is possible, even with IE 9.0 and as far back as IE 3.0. The browser doesn't affect Javascript features, only the revision (version) supported. Javascript features are not controlled by Microsoft, only the implementation. ECMA controls Javascript features. Most of the time I have to figure out (guess) what you want. And I don't always get a reply. a simple :thumbsup: or Yes, ok. or :thumbsdown: or No, not ok. I think your problem is storing numbers in strings, and applying C++ use (ie pointers) to them. Obviously the lack of computer books in your own language means that you could be learning from bad translation where the meaning of concepts is lost. Maybe you should learn English. Then the barriers to understanding won't slow you down.
"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.
-
If you are referring to array.reverse, then it is possible, even with IE 9.0 and as far back as IE 3.0. The browser doesn't affect Javascript features, only the revision (version) supported. Javascript features are not controlled by Microsoft, only the implementation. ECMA controls Javascript features. Most of the time I have to figure out (guess) what you want. And I don't always get a reply. a simple :thumbsup: or Yes, ok. or :thumbsdown: or No, not ok. I think your problem is storing numbers in strings, and applying C++ use (ie pointers) to them. Obviously the lack of computer books in your own language means that you could be learning from bad translation where the meaning of concepts is lost. Maybe you should learn English. Then the barriers to understanding won't slow you down.
"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.
Finally, I tried the following code.
var arrIns = [
"1","21","24","28","42","48",
"9","13","14","16","24","49",
"3","18","19","25","44","45"
];
var arr = [];
var tmp = 0;
var IsElm = 0;
function indexe(){
for(var i=0; i<arrIns.length-1; i++)
{
if(arrIns[i] != arrIns[i+1]) { // arrIns[arrIns.Length - 1] = tmp;
IsElm = i; // i temp
arr[tmp++] = arrIns[i];
arrIns.splice(arrIns[IsElm]);
}
return --IsElm;
document.write(arr[tmp++] + " : " + arrIns.indexOf(arrIns[i]) + "<BR>");
//return arrIns.indexOf(arrIns[i]);
}
}Hakan cursed chats dealer :)
-
If you are referring to array.reverse, then it is possible, even with IE 9.0 and as far back as IE 3.0. The browser doesn't affect Javascript features, only the revision (version) supported. Javascript features are not controlled by Microsoft, only the implementation. ECMA controls Javascript features. Most of the time I have to figure out (guess) what you want. And I don't always get a reply. a simple :thumbsup: or Yes, ok. or :thumbsdown: or No, not ok. I think your problem is storing numbers in strings, and applying C++ use (ie pointers) to them. Obviously the lack of computer books in your own language means that you could be learning from bad translation where the meaning of concepts is lost. Maybe you should learn English. Then the barriers to understanding won't slow you down.
"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.
:thumbsup:
Hakan cursed chats dealer :)
-
:thumbsup:
Hakan cursed chats dealer :)
I used to ur method
var arrIns = [
"1","21","24","28","42","48",
"9","13","14","16","24","49",
"3","18","19","25","44","45"
];
var arr = [];
var AllLucky= [];
var ct = 0;
var n = 0;do{
for(var i=arrIns.length; i>0; --i)
{
arrIns[i] = arr[i];
for(var j=0; j<arrIns.lenght; j++)
{
if(!arrIns[arr[j]]) {
arrIns[arr[j]] = AllLucky[ct];
document.write(AllLucky[ct] + "<BR>");
ct++; n++;
}
}
}
}while(n<1);output is 24 must be ?
Hakan cursed chats dealer :)
-
I used to ur method
var arrIns = [
"1","21","24","28","42","48",
"9","13","14","16","24","49",
"3","18","19","25","44","45"
];
var arr = [];
var AllLucky= [];
var ct = 0;
var n = 0;do{
for(var i=arrIns.length; i>0; --i)
{
arrIns[i] = arr[i];
for(var j=0; j<arrIns.lenght; j++)
{
if(!arrIns[arr[j]]) {
arrIns[arr[j]] = AllLucky[ct];
document.write(AllLucky[ct] + "<BR>");
ct++; n++;
}
}
}
}while(n<1);output is 24 must be ?
Hakan cursed chats dealer :)
I will take a look at today's messages later tonight. there is spelling mistake, length
for(var j=0; j
:)
Q. Are you trying to create a 2D table that indexes all of arrIns?
0, "1"
12, "3"
6, "9"
.
.
11, "49"the line below is deleting arrIns[i] items.
problem is arr[i] = undefined (empty like c++ void).
so, arrIns[i] = undefined.arrIns[i] = arr[i];
Not enough code to test it.
I need array AllLucky. ;)"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. -
I used to ur method
var arrIns = [
"1","21","24","28","42","48",
"9","13","14","16","24","49",
"3","18","19","25","44","45"
];
var arr = [];
var AllLucky= [];
var ct = 0;
var n = 0;do{
for(var i=arrIns.length; i>0; --i)
{
arrIns[i] = arr[i];
for(var j=0; j<arrIns.lenght; j++)
{
if(!arrIns[arr[j]]) {
arrIns[arr[j]] = AllLucky[ct];
document.write(AllLucky[ct] + "<BR>");
ct++; n++;
}
}
}
}while(n<1);output is 24 must be ?
Hakan cursed chats dealer :)
please explain your signature: Hakan cursed chats dealer :) If you are just messing people about, I will stop helping right now. :mad:
"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.
-
please explain your signature: Hakan cursed chats dealer :) If you are just messing people about, I will stop helping right now. :mad:
"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.
Just kidding!! Please don't offense on you.
Hakan cursed chats dealer :)
-
Just kidding!! Please don't offense on you.
Hakan cursed chats dealer :)
ok. :| post message explain the arrays, differences AllLucky arrIns arr :confused: Help me to see what each one will look like at the end of code.
"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.
-
ok. :| post message explain the arrays, differences AllLucky arrIns arr :confused: Help me to see what each one will look like at the end of code.
"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.
if(!arrIns[arr[j]])
is 24 AllLucky[ 24 ] differencly
-
if(!arrIns[arr[j]])
is 24 AllLucky[ 24 ] differencly
9 10 38 40 46 48
there is no pick number this week too :) lotto combination is uselessness
-
9 10 38 40 46 48
there is no pick number this week too :) lotto combination is uselessness
Q1. is arr[] lucky numbers to add to existing ? Q2. So, you want to add new set of lucky numbers to arrIns, but only if they do not exist in arrIns. Yes? =============================================== from what you told me before I thought old lucky numbers would get replaced var arrIns = [ "1","21","24","28","42","48", // week-2 is removed "9","10","38","40","46","48" // this is new week-2 set "9","13","14","16","24","49", "3","18","19","25","44","45", ]; or var arrIns = [ "1","21","24","28","42","48", "9","13","14","16","24","49", "3","18","19","25","44","45", "9","10","38","40","46","48" // new week-2 ]
"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.