I Bet You Cant Do This With Javascript, *check Out* - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › I Bet You Cant Do This With Javascript, *check Out* (1314 Views)
| I Bet You Cant Do This With Javascript, *check Out* by Cybergenius(op): 4:01pm On Nov 01, 2014 |
Lets see how you know javascript! -- Write a function that takes an argument and returns that argument idf = identify(3); idf() //3 |
| Re: I Bet You Cant Do This With Javascript, *check Out* by Cybergenius(op): 4:06pm On Nov 01, 2014*. Modified: 4:42pm On Nov 01, 2014 |
My attempt function identify(q){ return q; } idf = identify(2); idf() //"TypeError: 2(value of expression idf) is not object" |
| Re: I Bet You Cant Do This With Javascript, *check Out* by blueyedgeek(m): 5:14pm On Nov 01, 2014 |
This should be pretty easy to implement. function identify(val){ |
| Re: I Bet You Cant Do This With Javascript, *check Out* by Cybergenius(op): 5:36am On Nov 02, 2014 |
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 |
| Re: I Bet You Cant Do This With Javascript, *check Out* by blueyedgeek(m): 7:02am On Nov 02, 2014 |
Cybergenius:Oh, I'm supposed to set a variable equal to the result of calling the identify function. Why do I need to call it like a function? |
| Re: I Bet You Cant Do This With Javascript, *check Out* by dhtml(m): 8:29am On Nov 02, 2014 |
Try this: function identify(){return arguments[0];}Try zat |
| Re: I Bet You Cant Do This With Javascript, *check Out* by bot101(m): 11:47am On Nov 02, 2014 |
. |
| Re: I Bet You Cant Do This With Javascript, *check Out* by Cybergenius(op): 5:38pm On Nov 03, 2014 |
blueyedgeek:thats the challenge |
| Re: I Bet You Cant Do This With Javascript, *check Out* by dhtml(m): 7:39pm On Nov 03, 2014 |
Your post was not clear from the begining. . . |
| Re: I Bet You Cant Do This With Javascript, *check Out* by cyrielo(m): 11:05am On Nov 04, 2014 |
baby challenge |
| Re: I Bet You Cant Do This With Javascript, *check Out* by Cybergenius(op): 5:04pm On Nov 04, 2014 |
Building A Word Scramble Game With Javascript (text Based) • How To Get A User IP Address With Javascript • Hashtag Highlighting Like Twitter With Javascript • 2 • 3 • 4
What Browser Should I Use? Say Goodbye To Tracking And Say HI! To Privacy! • Where Can I Find A Code Academy In Lagos, Close To Ogudu Or Anthony? • Programmers Psychological Advice Needed Plz