Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,965 members, 7,956,617 topics. Date: Monday, 23 September 2024 at 03:23 PM |
Nairaland Forum / Science/Technology / Programming / Challenge For Javascript Beginners/intermidiate (4467 Views)
Introduction To Airtable For Javascript Developers / Whatsapp Group For Javascript Developers / Learn And Get The Source Code For Javascript Type Writer Code (2) (3) (4)
Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 4:05pm On Sep 13, 2017 |
I would post a question u guys should try ur best to answer..if u cant i would drop the solution.....others are welcome to drop questions.... Note:dont drop a question u dont have answer to 1 Like |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 4:08pm On Sep 13, 2017 |
Question 1: Write a function that checks if a variable has been defined. |
Re: Challenge For Javascript Beginners/intermidiate by Alexanda07(m): 6:10pm On Sep 13, 2017 |
Jaddo19: A defined variable in JS is one that has a value. If there is no value, its means JS will consider it as undefined.. function checkUndefined(x){ if (typeof(x) === 'undefined') { return "Value is undefined"; else{ return "Value is defined"; } } console.log(checkUndefined(x)); // Just type any letter in the alphabet not defined with a value. 3 Likes |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 7:17pm On Sep 13, 2017 |
Alexanda07:Nice one...my solution was without typeof....all the same |
Re: Challenge For Javascript Beginners/intermidiate by nerdshed: 10:30am On Sep 14, 2017 |
function checkVar(word) { if (typeof word === 'undefined'){ return "Variable not defined"; } } |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 2:08pm On Sep 14, 2017 |
nerdshed:Nice.... |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 2:16pm On Sep 14, 2017 |
My solution....
|
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 2:20pm On Sep 14, 2017 |
Challenge 2. LOOPING A TRIANGLE write a loop that makes 7 calls to console.log to output the following # ## ### #### ##### ###### ####### |
Re: Challenge For Javascript Beginners/intermidiate by Alexanda07(m): 5:26pm On Sep 14, 2017 |
Jaddo19: var item = '#' ; for (let count=0; count<7; count++) { console.log(item); item+='#'; } OR var item = '#' ; var count = 0; while (count<7){ console.log(item); item+='#' ; count++; } |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 6:58pm On Sep 14, 2017 |
Alexanda07:I avnt run that code buh am really not sure it is gonna work |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 7:01pm On Sep 14, 2017 |
The # is to output 7 times...so why incrementing it again...think harder bro u are close to d answer |
Re: Challenge For Javascript Beginners/intermidiate by Alexanda07(m): 7:56pm On Sep 14, 2017 |
Jaddo19: Like you said, you have not run it. So you dont conclude without checking out. But I have checked it out both of them and it run perfectly... 1 Like |
Re: Challenge For Javascript Beginners/intermidiate by Alexanda07(m): 7:57pm On Sep 14, 2017 |
Jaddo19: As a new programmer like you, Its all about and thinking and more PRACTICE and not theory and assumptions like you are looking at it now. |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 9:05pm On Sep 14, 2017 |
Alexanda07:I was wrong....i didnt check d code properly also didnt run... Am sorry 1 Like |
Re: Challenge For Javascript Beginners/intermidiate by nsimageorge(m): 6:38pm On Sep 17, 2017 |
Jaddo19: var x; for (x = "#"; x.length <= 7; x += "#" ) console.log(x); |
Re: Challenge For Javascript Beginners/intermidiate by Olumyco(m): 12:31pm On Sep 18, 2017 |
Jaddo19: function triHashes(a) { if (a.length <= 7) { console.log(a); return triHashes(a + '#'); } } triHashes('#'); |
Re: Challenge For Javascript Beginners/intermidiate by Nastydroid(m): 1:44pm On Sep 19, 2017 |
Olumyco: alert 'Only for intermediate' |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 8:45am On Sep 20, 2017 |
Nice one guys.....i Av been busy lately....everyone is welcome to drop a challenge |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 2:03pm On Sep 20, 2017 |
Lemme drop this simple one so beginners can participate. . Challenge 3. Write a function that works just like console.log |
Re: Challenge For Javascript Beginners/intermidiate by Kodejuice: 8:23pm On Sep 20, 2017 |
Jaddo19: console.log = (...a) => console.error(...a); LoL 1 Like |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 9:52pm On Sep 20, 2017 |
Kodejuice:Eeehmm |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 12:38pm On Sep 22, 2017 |
Since no one has a solution to d challenge should I drop d answer nii |
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 6:41pm On Sep 22, 2017 |
Jaddo19: Gimme 24 more hours am trying to get the solution |
Re: Challenge For Javascript Beginners/intermidiate by liliian(f): 7:13pm On Sep 22, 2017 |
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 7:32pm On Sep 22, 2017 |
console.log("#" console.log("##" console.log("###" console.log("####" console.log("#####" console.log("######" console.log("#######" // Using Repeat Method for(var i = 1; i < 8; i++){ console.log("#".repeat(i)) } |
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 7:36pm On Sep 22, 2017 |
modash: please share your method as well |
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 7:46pm On Sep 22, 2017 |
Jaddo19:all the solutions given to your second problem work all of them |
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 7:51pm On Sep 22, 2017 |
var repeatt = "#" for(var i = 1; i < 8; i++){ console.log(repeatt); repeatt += "#"} |
Re: Challenge For Javascript Beginners/intermidiate by nsimageorge(m): 7:59pm On Sep 22, 2017 |
Jaddo19: Sigh!! How else do you want to write on js console without the console object There is no other way to get a function that works just like console.log without referring to the console object. Please post the answer, maybe I might be wrong, I am willing to learn something new... |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 8:14pm On Sep 22, 2017 |
modash:I did not test all d codes buh I would drop my own solution so those who got it wrong can correct them selves |
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 8:17pm On Sep 22, 2017 |
Solution to challenge 3: function print(x){ |
Re: Challenge For Javascript Beginners/intermidiate by nsimageorge(m): 8:19pm On Sep 22, 2017 |
Jaddo19: This function would not write on the console. |
Oracle 10g On Solaris Os / I Coded A Picture Freehanded With Html / Naira Music - Nigerian Music App
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 26 |