JavaScript and JSX are closely related technologies used in modern web development, especially in React applications.
-What is JavaScript (.js)?
JavaScript is a programming language used to create dynamic and interactive web applications. Files with the .js extension contain pure JavaScript code.
JavaScript is commonly used for:
1.Variables and functions
2.Loops and conditions
3.API calls
4.Event handling
5.DOM manipulation
6.Business logic
Example :
function add(a, b) {
return a + b;
}
console.log(add(5, 3));
What is JSX (.jsx)?
JSX stands for JavaScript XML. It is a syntax extension for JavaScript that allows developers to write HTML-like code inside JavaScript.
JSX is mainly used in React to create user interface components.
Example :
function App() {
return (
<div>
<h1>Hello React</h1>
</div>
);
}
export default App;
Top comments (0)