Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,162,984 members, 7,852,315 topics. Date: Thursday, 06 June 2024 at 04:00 PM

Challenge For Javascript Beginners/intermidiate - Programming (2) - Nairaland

Nairaland Forum / Science/Technology / Programming / Challenge For Javascript Beginners/intermidiate (4285 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)

(1) (2) (3) (Reply) (Go Down)

Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 8:19pm On Sep 22, 2017
Very easy...i came up with that stuff when my console.log always return "undefined" along with my output...so I thought of a way to eliminate d "undefined"
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 8:22pm On Sep 22, 2017
nsimageorge:


This function would not write on the console.
Try it out
Re: Challenge For Javascript Beginners/intermidiate by nsimageorge(m): 8:38pm On Sep 22, 2017
Jaddo19:

Try it out

It didn't work. Except you are testing your code in a non-popular environment.
To the best of my knowledge, the javascript console can be accessed only through the console object.

1 Like

Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 8:39pm On Sep 22, 2017
I tried it with typeof,object,array...and it worked
Re: Challenge For Javascript Beginners/intermidiate by Nobody: 8:40pm On Sep 22, 2017
write a program that'Ll prompt user to enter 0 to conver from usd to rmb. And 1 to convert from rmb to usd
Like this
Enter exchange rate from $ to rmb-6.81
Enter 0 to convert usd-rmb and 1 vice versa
Enter dollar amount-$100
$100 is 681.0yuan
Enter the exchange rate from $-rmb-Enter 0 to convert usd-rmb and 1 vice versa
Enter the rmb amount-10000
10000yuan is $1468.43
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 8:43pm On Sep 22, 2017
nsimageorge:


It didn't work. Except you are testing your code in a non-popular environment.
To the best of my knowledge, the javascript console can be accessed only through the console object.
I can send u a screenshot if u want...it worked on node.js and my browser console

1 Like

Re: Challenge For Javascript Beginners/intermidiate by modash(m): 9:02pm On Sep 22, 2017
Jaddo19:

I can send u a screenshot if u want...it worked on node.js and my browser console
Its going to work but
The return keyword is
Different to the console.log
It both prints outs a message
But the return bring back a value while console.log print out but is actually undefined
Re: Challenge For Javascript Beginners/intermidiate by vaspire: 9:28pm On Sep 22, 2017
Jaddo19:
Question 1:
Write a function that checks if a variable has been defined.
function checkVariableUndefined(){
If (Variable===undefined){
console.log ('Variable Undefined')
}else{
console.log('Variable defined')
}
}
checkVariableUndefined()

...still a beginner, help your girl rate her code mbok...
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 9:32pm On Sep 22, 2017
vaspire:

function checkVariableUndefined(){
If (Variable===undefined){
console.log ('Variable Undefined')
}else{
console.log('Variable defined')
}
}
checkVariableUndefined()

...still a beginner, help your girl rate her code mbok...
Nice one.....
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 9:34pm On Sep 22, 2017
vaspire:

function checkVariableUndefined(){
If (Variable===undefined){
console.log ('Variable Undefined')
}else{
console.log('Variable defined')
}
}
checkVariableUndefined()

...still a beginner, help your girl rate her code mbok...
Your function doesn't have a argument,
checkVariableUndefined(argument)

2 Likes

Re: Challenge For Javascript Beginners/intermidiate by Nobody: 10:08pm On Sep 22, 2017
bjhaid:
write a program that'Ll prompt user to enter 0 to conver from usd to rmb. And 1 to convert from rmb to usd
Like this
Enter exchange rate from $ to rmb-6.81
Enter 0 to convert usd-rmb and 1 vice versa
Enter dollar amount-$100
$100 is 681.0yuan
Enter the exchange rate from $-rmb-Enter 0 to convert usd-rmb and 1 vice versa
Enter the rmb amount-10000
10000yuan is $1468.43
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 10:13pm On Sep 22, 2017
bjhaid:
write a program that'Ll prompt user to enter 0 to conver from usd to rmb. And 1 to convert from rmb to usd
Like this
Enter exchange rate from $ to rmb-6.81
Enter 0 to convert usd-rmb and 1 vice versa
Enter dollar amount-$100
$100 is 681.0yuan
Enter the exchange rate from $-rmb-Enter 0 to convert usd-rmb and 1 vice versa
Enter the rmb amount-10000
10000yuan is $1468.43
This yha challenge dey fear person ooo....but I would try to do something about it.....pls explain better to avoid stories that touch
Re: Challenge For Javascript Beginners/intermidiate by Nobody: 10:57pm On Sep 22, 2017
Jaddo19:

This yha challenge dey fear person ooo....but I would try to do something about it.....pls explain better to avoid stories that touch
try with prompts and conditionals
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 3:43pm On Sep 23, 2017
bjhaid:
try with prompts and conditionals
Pls explain this ur challenge well.....i have solved the prompt part of it so explain that conversion aspect well
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 6:53am On Sep 24, 2017
bjhaid:
try with prompts and conditionals
I got a solution to your challenge on paper all that's left is testing it.....my solution converts from dollar to naira and vice versa hope u don't mind
Re: Challenge For Javascript Beginners/intermidiate by Nobody: 12:13pm On Sep 24, 2017
Jaddo19:

I got a solution to your challenge on paper all that's left is testing it.....my solution converts from dollar to naira and vice versa hope u don't mind
don't mind, let's see the solution
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 9:46pm On Sep 24, 2017
bjhaid:
write a program that'Ll prompt user to enter 0 to conver from usd to rmb. And 1 to convert from rmb to usd
Like this
Enter exchange rate from $ to rmb-6.81
Enter 0 to convert usd-rmb and 1 vice versa
Enter dollar amount-$100
$100 is 681.0yuan
Enter the exchange rate from $-rmb-Enter 0 to convert usd-rmb and 1 vice versa
Enter the rmb amount-10000
10000yuan is $1468.43


var stringAnswer = prompt("Enter 0 to Convert From USD to RMB,And 1 to Convert From RMB to USD And Quit To Exit The App"wink
var numberString = Number(stringAnswer)
while(stringAnswer !== "quit"wink{
if(numberString === 0){
var stringAmount = prompt("How Much USD Do you Want to Convert to RMB"wink;
var amount = Number(stringAmount);
rmb(amount);
}
else if(numberString === 1){
var stringAmount1 = prompt("How Much RMB Do You Want To Convert To USD"wink;
var amount1 = Number(stringAmount1);

usd(amount1);
}
stringAnswer = prompt("Enter 0 to Convert From USD to RMB,And 1 to Convert From RMB to USD And Quit To Exit The App"wink
numberString = Number(stringAnswer)

}
alert("You Have Quit The App"wink;

function rmb(money){
var result = money * 6.81
alert(result + " USD"wink;
return result
}

function usd(money){
var result1 = money / 6.81
alert(result1 + " RMB"wink;
return result1
}
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 9:47pm On Sep 24, 2017
I Optimized It Abit
i just tried it and it works
Re: Challenge For Javascript Beginners/intermidiate by Nobody: 9:51pm On Sep 24, 2017
modash:
I Optimized It Abit
i just tried it and it works
okay, little diff from mine, will post tomorrow
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 9:54pm On Sep 24, 2017
bjhaid:
okay, little diff from mine, will post tomorrow
cool, will see your tomorrow then
any other challenges
Re: Challenge For Javascript Beginners/intermidiate by Nobody: 9:58pm On Sep 24, 2017
modash:

cool, will see your tomorrow then
any other challenges
write a program that prints

Foo
Bar
Fooz

Repeatedly ten times
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 11:58pm On Sep 24, 2017
bjhaid:
write a program that prints

Foo
Bar
Fooz

Repeatedly ten times

for(var i = 0; i < 10; i++){
console.log("Foo"wink
console.log("Bar"wink
console.log("Fooz"wink
}
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 7:17am On Sep 25, 2017

var prom=prompt('enter 0 to convert from dollar to naira and 1 to convert from naira to dollor');
if(!isNaN(promp)&&promp<=1){
if(promp==0){
var dollar=prompt('enter dollar figure u want to convert to naira');
if(isNaN(dollar)){
document.write(dollar);
}else{
let result=dollar*360;
document.write(result);
}
}else{
let naira=prompt('enter naira figure u want to convert to dollar');
if(isNaN(naira)){
document.write(naira);
}else{
let resul= naira/360;
document.write(resul);
}
}
}
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 7:21am On Sep 25, 2017
just incase i am not here to reply those that would say d code did not work......i tested and retested d code and its working fine
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 7:25am On Sep 25, 2017
i misplaced my phone so i wouldnt be here for a while...i had to borrow someones phone so i could paste my solution........ like i always say everyone is welcome to post a challenge so d thread wouldnt die for beginners sake....God bless u all
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 9:07am On Sep 25, 2017
modash:



var stringAnswer = prompt("Enter 0 to Convert From USD to RMB,And 1 to Convert From RMB to USD And Quit To Exit The App"wink
var numberString = Number(stringAnswer)
while(stringAnswer !== "quit"wink{
if(numberString === 0){
var stringAmount = prompt("How Much USD Do you Want to Convert to RMB"wink;
var amount = Number(stringAmount);
rmb(amount);
}
else if(numberString === 1){
var stringAmount1 = prompt("How Much RMB Do You Want To Convert To USD"wink;
var amount1 = Number(stringAmount1);

usd(amount1);
}
stringAnswer = prompt("Enter 0 to Convert From USD to RMB,And 1 to Convert From RMB to USD And Quit To Exit The App"wink
numberString = Number(stringAnswer)

}
alert("You Have Quit The App"wink;

function rmb(money){
var result = money * 6.81
alert(result + " USD"wink;
return result
}

function usd(money){
var result1 = money / 6.81
alert(result1 + " RMB"wink;
return result1
}

i dunno why the wink emoji keeps appearing on nairaland
Re: Challenge For Javascript Beginners/intermidiate by Jaddo19(m): 10:21am On Sep 25, 2017
modash:


i dunno why the wink emoji keeps appearing on nairaland
Next time wrap ur code in a quote tag.....its better than nairaland code tag......it should eliminate d emoji
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 10:26am On Sep 25, 2017
Jaddo19:

Next time wrap ur code in a quote tag.....its better than nairaland code tag......it should eliminate d emoji
Thanks
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 2:29pm On Sep 25, 2017
I have an interesting challenge, write a program that gives you factorial of a number
E.g
5! = 5*4*3*2*1 = 120
4! = 4*3*2*1 = 24
3! = 3*2*1 = 6
2! = 2*1 = 2
1! = 1*1 = 1
0! = 1 (note the answer for zero factorial)
Re: Challenge For Javascript Beginners/intermidiate by Silverman42(m): 12:07am On Sep 26, 2017
 function factorial(num) {
if(num === 0)
{
return 1
}
product = num * factorial(num-1)
console.log(product);
return product;
}
factorial(5)
Re: Challenge For Javascript Beginners/intermidiate by modash(m): 6:26pm On Sep 27, 2017
Àny other trys
Re: Challenge For Javascript Beginners/intermidiate by myrum(m): 1:05am On Sep 28, 2017
please is there any .Net programmer whom I can work with as an intern in the house I just rounded up my training on Asp. Net MVC would really appreciate 08118559693 from Lagos

(1) (2) (3) (Reply)

Ubuntu Whatsapp Group / Ready For Flat Surface Disc-shaped circumference Earth Alternate Truth ? / Processing Games And Tangible User Interface

(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. 40
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.