₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,009 members, 8,419,904 topics. Date: Thursday, 04 June 2026 at 07:07 AM

Toggle theme

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

Nairaland ForumScience/TechnologyProgrammingPlease Help Detect The Error In The Code (611 Views)

1 Reply (Go Down)

Please Help Detect The Error In The Code by johnhood(op): 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
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
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(op): 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(op): 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
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?
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(op): 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 Me With The CodeEncountering This Error In Django: TypeError: 'module' Object Is Not IterableWhat Was Used To Compile The Code That Was Used In Creating A Compiler?234

What Should I Start From Between XHTML And HTML5Please Who Has A This ScriptGet The Best Bitcoin Investment Website, Brokers Website, Trading Website