https://github.com/ash914027/backend
Backend_techologies-nodejs,express
https://github.com/ash914027/backend
crud eventemitter express javascript mongodb nodejs objectrealationmapping postgresql-database server sockets
Last synced: 25 days ago
JSON representation
Backend_techologies-nodejs,express
- Host: GitHub
- URL: https://github.com/ash914027/backend
- Owner: Ash914027
- Created: 2024-01-25T07:20:22.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-08-29T12:45:34.000Z (about 1 year ago)
- Last Synced: 2025-01-27T08:43:04.025Z (8 months ago)
- Topics: crud, eventemitter, express, javascript, mongodb, nodejs, objectrealationmapping, postgresql-database, server, sockets
- Language: JavaScript
- Homepage:
- Size: 84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🔢Basic and advanced javascript
# variable in javascript
Variables are containers for storing data values in a program.
They provide named references to memory locations, allowing you to manipulate data.
In JavaScript, variables are declared using the keywords var, let, or const.var a = "I am global";
let b = "I am global";
# 🍏Objects in javascript
// Object literal notation
let car = {
make: "Toyota",
model: "Camry",
year: 2022,
isElectric: false,start: function() {
console.log("Engine started!");
}
};## 🔄loops
1. for Loop:Executes a block of code a specified number of times.
for (let i = 0; i < 5; i++) {
console.log(i);
}## 🍏Arrays in javascript
// Creating an arraylet fruits = ["apple", "banana", "orange", "grape"];
// Accessing elements
console.log(fruits[0]); // Outputs: apple
console.log(fruits[2]); // Outputs: orange## Hoisting with 'var'
console.log(x); // undefined
var x = 5;
console.log(x); // 5The first console.log(x) outputs undefined because the declaration is hoisted, but the assignment (x = 5) happens later in the code.
## function in javascript
const multiply = function(a, b) {
return a * b;
};// Invocation
const product = multiply(4, 6);
console.log('Function Expression - Product:', product);## setTimeout function
Executes a function or a piece of code once after a specified delay.const delayedFunction = () => {
console.log('Delayed function executed!');
};setTimeout(delayedFunction,2000); // Executes after 2 seconds
## Arrow function
const subtract = (a, b) => a - b;
/ Invocationconst difference = subtract(8, 3);
console.log('Arrow Function - Difference:', difference);
## Callback function: Asynchornous
function parentFunction(name, callback){setTimeout(callback,1000);
console.log("Hey "+name);
}
function randomFunction(){
console.log("Hey I am callbackfunction");
}
parentFunction("Random String",randomFunction);##Synchronous Callback Function Example
function parentFunction(name, callback){
callback();
console.log("Hey "+name);
}
function randomFunction(){
console.log("Hey I am callbackfunction");
}
parentFunction("Random String",randomFunction);