Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,160,743 members, 7,844,441 topics. Date: Wednesday, 29 May 2024 at 09:12 PM

Please Help Detect The Error In The Code - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Please Help Detect The Error In The Code (469 Views)

Help Me With The Code / What Was Used To Compile The Code That Was Used In Creating A Compiler? / I’m One With The Code, The Code Is With Me. (2) (3) (4)

(1) (Reply) (Go Down)

Please Help Detect The Error In The Code by johnhood(m): 12:20am On Nov 17, 2020
Please I'm a novice in programming.
My main aim of the JavaScript snippet below is I want to declare a global function and use the value for my second function but when I ran the code it did not work. Please I appreciate if someone can point out the error for me.

function fun1() {var n=6.7569;
var ns=n.toFixed(2 );}
function fun2() {var t=prompt.window("what is your number?" );
var ps=document.getElementById("ut2" ).innerHTML=t*fun1()}; }
Re: Please Help Detect The Error In The Code by cixak95211: 12:30am On Nov 17, 2020
Where did you dig out the tutorial you're following?
"var" in 2020?
Besides, you didn't even paste the error message you're receiving . .
and also do well, to send a screenshot of the entire code block invoking the functions

2 Likes

Re: Please Help Detect The Error In The Code by Nobody: 1:25am On Nov 17, 2020
cixak95211:
Where did you dig out the tutorial you're following?
"var" in 2020?
Besides, you didn't even paste the error message you're receiving . .
and also do well, to send a screenshot of the entire code block invoking the functions

The irony is that let still converts to var , when you check the ES5 code

1 Like

Re: Please Help Detect The Error In The Code by cixak95211: 1:36am On Nov 17, 2020
pcguru1:


The irony is that let still converts to var , when you check the ES5 code

True, not just "let", all ES6+ keywords/expressions will be transpiled , but at least to keep your sanity intact,
you'd want to keep up with ECMA grin grin
Re: Please Help Detect The Error In The Code by johnhood(m): 5:02am On Nov 17, 2020
cixak95211:
Where did you dig out the tutorial you're following?
"var" in 2020?
Besides, you didn't even paste the error message you're receiving . .
and also do well, to send a screenshot of the entire code block invoking the functions
I am confused. "var" is for variable.
Re: Please Help Detect The Error In The Code by johnhood(m): 5:05am On Nov 17, 2020
cixak95211:
Where did you dig out the tutorial you're following?
"var" in 2020?
Besides, you didn't even paste the error message you're receiving . .
and also do well, to send a screenshot of the entire code block invoking the functions
Re: Please Help Detect The Error In The Code by etoluw: 7:10am On Nov 17, 2020
johnhood:
Please I'm a novice in programming.
My main aim of the JavaScript snippet below is I want to declare a global function and use the value for my second function but when I ran the code it did not work. Please I appreciate if someone can point out the error for me.

function fun1() {var n=6.7569;
var ns=n.toFixed(2 );}
function fun2() {var t=prompt.window("what is your number?" );
var ps=document.getElementById("ut2" ).innerHTML=t*fun1()}; }


2errors

1. it is window.prompt not prompt.windoww

2, you have to add return ns in fun1

4 Likes

Re: Please Help Detect The Error In The Code by Jas80: 12:01pm On Nov 17, 2020
cixak95211:
Where did you dig out the tutorial you're following?
"var" in 2020?
Besides, you didn't even paste the error message you're receiving . .
and also do well, to send a screenshot of the entire code block invoking the functions

oga, he said he is a beginner, how is he going to know the difference between bar and let if he doesn't try them out?

3 Likes

Re: Please Help Detect The Error In The Code by Lamexx(m): 2:22pm On Nov 17, 2020
johnhood:
Please I'm a novice in programming.
My main aim of the JavaScript snippet below is I want to declare a global function and use the value for my second function but when I ran the code it did not work. Please I appreciate if someone can point out the error for me.

function fun1() {var n=6.7569;
var ns=n.toFixed(2 );}
function fun2() {var t=prompt.window("what is your number?" );
var ps=document.getElementById("ut2" ).innerHTML=t*fun1()}; }

As a beginner, if you are learning how to code, you should be posting queries or question to `stackoverflow`. That is the platform for developers (experienced and novice).
Re: Please Help Detect The Error In The Code by johnhood(m): 6:44pm On Nov 17, 2020
etoluw:


2errors
1. it is window.prompt not prompt.windoww
2, you have to add return ns in fun1
Thanks. Let me try it out.

(1) (Reply)

. / Help! I Need Help With Golang Code. / .

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