About Java Script Programming

I am unable to understand the Java variables and scripts in Java …can anyone explain me the two topics more eloborately

@d.niha99 hey dear , in javascript ,variable is defined by keyword “var” and best thing in javascirpt is that there is no need to define which type of data we use or which type of data( such as int, float, character) we stored in that variable. To print any statement in js code there is console.log() function.

hello, @bhaveshssonewale can you explain to me the program given in the “CREATING YOUR FUNCTIONS IN THE JAVASCRIPT” section…I need the flow of the program how it goes

@d.niha Hello,Hope this helps you.

In JS Code:
First your defining the function and naming it as “myfunction” then passing a parameter “myName” as input,then in brackets{}, your saying to perform a funtion.Now your creating variable “elem” and assigning the document method which returns an element object representing the element
whose id matches with the string (“hello” in our case),then using “.innerHTML” your replacing your msg with the input “myName”.
Now if we go to the main part…if you know the basics of html I would directly skip to the execution.

In Html Code:
Inside “button” attribute when ur calling the function you wrote, your passing the parameter “BoltIot”. And this replaces “myName” in the JS code and displays it on Webpage when u click on the button.
Hope You Understood how the program works. :slight_smile:

@d.niha99 Adding one more resource to learn about javascript functions https://www.w3schools.com/js/js_functions.asp

Do let me know in case you need any other information.

1 Like

@dineshsagar2003.Thanku so much for your time and detail explanation

1 Like

@rahul.singh1
thanku so much for the source . I do check it