is javascript a programming language and what is it 2023

4 Min Read
javascript

JavaScript is a dynamic programming language used for creating websites, web apps, video games, and many other things. You can use it to add dynamic features to web sites that you couldn’t do with only HTML and CSS.

JavaScript is a scripting language widely used by browsers to create dynamic online content. When a drop down menu is clickable to display.

JavaScript’s Dynamic Features:

Because HTML and CSS, at their foundation, supply markups, they are frequently referred to as markup languages rather than programming languages.

You can view it here: https://codepen.io/Dillion/full/XWjvdMG.

As you type in the input field, the text appears on the screen in the codepen. JavaScript makes it possible for that.

We’ll examine them to help you get started with JS:

Chat GPT: What is it? what purpose of chat gPT 2023

JavaScript in HTML:

  • Comments
  • Data Types
  • Functions
  •  Variables

Use JavaScript in HTML:

[1] JavaScript internal, using the script tag
The script element is available for JavaScript declarations, just way the style tag is for style declarations within an HTML page. Here’s how to apply it:

[2] Embedded JavaScript
Here, JavaScript code is contained in HTML tags with unique JS-based properties.

HTML tags, for instance, offer event attributes that let you run some code directly inline when an event is triggered. What I mean is this:

Click me!

[3] External JavaScript:

// script.js
alert(“I am inside an external file”);

You can apply a source for the JavaScript code using the src attribute of the script tag. This reference is significant because it instructs the browser to download script.js’s content as well.

Index.html and script.js can both be found in the same directory, or script.js can be downloaded from another website. You must provide the complete URL (https://…/script.js) for the latter.

Take note of the.js extension. Like HTML has.html, JavaScript files have it as their extension.

JavaScript Functions:

console.log(“JavaScript”)
console.log(“Language”)

// some things here

console.log(“JavaScript”)
console.log(“Language”)

// more things here

console.log(“JavaScript”)
console.log(“Language”)

function print() {
console.log(“JavaScript”)
console.log(“Language”)
}

print()

// some things here

print()

// more things here

print()

:::::::::::
function findAverage(n1, n2, n3) {
let aver = (n1 + n2 + n3) / 3
return aver
}

let num1 = 5
let num2 = 6
let num3 = 8
let average = findAverage(num1, num2, num3)

// later on, somewhere else
let average2 = findAverage(…)

// later on, somewhere else
let average3 = findAverage(…)

Comments in JavaScript:
Similar to HTML, there are situations when we might wish to add a remark to our code that will not be performed.

JavaScript offers two options for accomplishing this:

single-line remarks such as this: // a single line comment or several lines of comments, such as this: /* a multi line comment */

JavaScript variables
Values of any data type can be stored in variables. When the variables are utilised in JavaScript, the values they hold are used to perform the operation.

Declared variables can have values assigned to them.

Name has been declared for the preceding, but it is not yet assigned a value.

According to what you might have expected from the data types section, JavaScript automatically gives name a value of undefined. Hence, undefined will be used for that operation if you try to use name anyplace.

Why allow? You could have wondered why, and this is why: There are three ways to declare variables in JavaScript:

The first console.log prints undefined when the print function is called (print()), but the second console.log returns an exception saying it “Cannot access age before activation.”

Share This Article
Follow:
Pankaj is the author of Bugs Solutions. Whatever information is given to you, check it to see if it is correct. If you have any problem, you can contact us and mail us.
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Most handsome man in the world 2024 Top Medical Institutions in India Top 10 Biggest Railways in India Secrets for Fast Hair Growth Glycerin for Hair: Your Ultimate Guide