Functions error

Functions error
0

#1
<html>
<title>
    functions
    </title>
    <body>
        <p>practise functions</p>
        <p id="fun"></p>
        <script>
            var x= function(a,b)
            {
                return a*b;
                document.getElementById("fun").innerHTML=x;
            }
            
        
        </script>
        
    </body>
</html>


can anyone help me why i am not getting the o/p properly…
I don’t no I am feeling functions are tough… irritated …


#2

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


#3

Nothing is calling your function.


#4

Tq for editing code …

to call the function … function(a,b); …


#5

That’s declaring it. Nothing tells it to run.


#6

I am confused …
I need to learn … then I will change my code …
TQ for helping … :slight_smile: