Cybergenius's Posts
Nairaland Forum › Cybergenius's Profile › Cybergenius's Posts
1 2 (of 2 pages)
Code challenge 2: Write a program to print out pascal triangle | | | | 2 | | 3 3 | | 4 6 4 | My try with JavaScript:
function pascalTriangle(rows) { |
Just want to know which of them is better and more profitable in nigeria, Replies Please. |
<?php echo "Happy Birthday bro"; ?> |
Check out the awesome Tictactoe game popularly know as X and O in Nigeria, built with JavaScript, with a very powerful AI, http://kodejuice.tk/game.html |
//tested and trusted function singleArr(arr){ var ret = [], arr = arr; for(i=0;i<arr.length;i++){ //if the item is an array if(arr[i] instanceof Array){ //loop through and add it to the 'ret' array variable for(c=0;c<arr[i].length;c++) ret.push(arr[i][c]); } else ret.push(arr[i]); } return ret; } console.log( singleArr([0,[1,2,3,4],5,[6,7,8,9],10,"end"]) ); //[0,1,2,3,4,5,6,"end"] |
No difference, they are both the same |
i fall under the Idi amin developer |
http://heliohost.org, supports - python,ruby,java,php,perl and so on.. For freee!!! |
blueyedgeek:thats the challenge |
blueyedgeek:you are wrong you didn't follow the rule, where is the idf variable? function identify(q){ return function(){ return q; } } idf = identify(3); idf() //3 |
My attempt function identify(q){ return q; } idf = identify(2); idf() //"TypeError: 2(value of expression idf) is not object" |
Lets see how you know javascript! -- Write a function that takes an argument and returns that argument idf = identify(3); idf() //3 |
<script> function no(q){ var rand = Math.floor(Math.random()*6); var numbers = []; function r(){ return arguments[Math.floor(Math.random()*arguments.length)]; } var q = (q)?q:2; for(i=0;i<q;i++){ numbers.push(r("080","070","081","090" +r("0","1","2","3","4","5","6","7","8","9" +r("0","1","2","3","4","5","6","7","8","9" +r("0","1","2","3","4","5","6","7","8","9" +r("0","1","2","3","4","5","6","7","8","9" +r("0","1","2","3","4","5","6","7","8","9" +r("0","1","2","3","4","5","6","7","8","9" +r("0","1","2","3","4","5","6","7","8","9" +r("0","1","2","3","4","5","6","7","8","9" );alert(numbers[i].replace(/[,]/ig,"" );} //array "number" now contains 3 mobile numbers or amount of arguments passed in. } no(4); //08035690651 //08152360846 //07056367416 //08035690651 </script> |
True Talk |
The above code is meant to compile my code in a script tag with an id of "#val", if i read the code by line, it wont work out, cause it would also read "while(!i){" as a code on its own, my question is - How do i read that particular block of code while(!i){ var i = jQuery; } read this as whole and not by line |
I have this html/javascript +jquery code, which is meant to compile my code, but i dont know how to read the javascript as a code. //the code <!DOCTYPE html> <html> <head> <script src="jquery.js"></script> <script async> window["logerrors"] = function(){ var script = $("script#val" .text().replace(/[\n]/ig,"};" ;var reps = script.replace(/};/ig,"~" ;var eachLine = reps.split("~" ;var errors =""; var err = []; for($i=0;$i<eachLine.length;$i++){ try{ new Function(eachLine[$i])(); err.push("no" ;continue; } catch(e){ errors += "Scope Number: "+ Number($i+1) +"<br>"+e + "<br><span style='color:red;white-space: pre'>"+eachLine [$i]+"</span><hr>"; err.push("yes" ;continue; } } if(err.indexOf("yes" > -1){$("body" .html(errors);} else{ return true; } } </script> </head> <body onLoad="logerrors()"> <script id="val"> var i = jQuery; while(!i){ var i = jQuery; } phrompt(i.fn.jquery); ro(q); //the while loop is an example, the code reads it as "while(!i){" </script> </body> </html> |
Please i need your feedbacks |
just built a progress bar plugin with jQuery, check it at - http://digbar.ml |
blueyedgeek:just joking *JERK* |
$(this).thread().find("olucurious" .hide().end().close(); |
OBSOLETE |
<script> $(this).thread().close(true); </script> |
Hey folks i need your help. I would like to know how to select the hashtags from a text with JavaScript (ex. #hash) and then apply a html link to the hashtag as follows... "DEMO":. I tried something like this -> "DEMO": this selects the hashtags, but how do i make the hashtag an html link. Thank you |
1 2 (of 2 pages)
+r("0","1","2","3","4","5","6","7","8","9"