What is javascript with basic example ?

Javascript is a programming language for the web apllications. Let’s start a script, Scripts are a group of codes from one language that do some specific operations . Now we want to start a simple one that show a message box when the page loads.

We must use a function to do opations, Functions are expressions that often get some input data and doing some operations on them and returning a value as a result, or do an operation and the result is visual changes in the page instead. A function for making a message box is in the second group. Look at its code then we’ll discuss more about it:

Basic Code:

<html>
<head>
<script>
alert(‘Hello’)
</script>
</head><body>
</body>
</html>

When you run this page (just when it loads), a message box will be shown:

Description: Message Box

‘alert’ is a function that shows box with text we passed as the argument. To insert input data to the functions, you must open a parenthesis. If you have a text as an input (like a message for a message box), it must be written between single our double quotes (‘text’ or “text”).

 

Leave a Reply

%d bloggers like this: