AuthorThese blogs are ideas and learning's of Wynisco employees and Bootcamp students Archives
May 2024
Categories |
Back to Blog
There are different types of data that we can use in a JavaScript program.
For example,
Here,
JavaScript Data Types There are eight basic data types in JavaScript. They are:
Here, all data types except Object are primitive data types, whereas Object is non-primitive
JavaScript Variables
4 Ways to Declare a JavaScript Variable:
Variables are containers for storing data (storing data values). In this example, x, y, and z, are variables, declared with the var keyword: Example var x = 5; var y = 6; var z = x + y; In this example, x, y, and z, are variables, declared with the let keyword: Example let x = 5; let y = 6; let z = x + y; In this example, x, y, and z, are undeclared variables: Example x = 5; y = 6; z = x + y; From all the examples above, you can guess:
When to Use JavaScript const?
JavaScript Functions A JavaScript function is a block of code designed to perform a particular task.A JavaScript function is executed when "something" invokes it (calls it). Example
JavaScript Function Syntax
A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses ().Function names can contain letters, digits, underscores, and dollar signs (same rules as variables).The parentheses may include parameter names separated by commas:(parameter1, parameter2, ...)The code to be executed, by the function, is placed inside curly brackets: {}
Function parameters are listed inside the parentheses () in the function definition. Function arguments are the values received by the function when it is invoked. Inside the function, the arguments (the parameters) behave as local variables. A Function is much the same as a Procedure or a Subroutine, in other programming languages.
0 Comments
Read More
Your comment will be posted after it is approved.
Leave a Reply. |