Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Assigments/Assigment#1/Q1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let BoolVar=True;
var b="Shahid"
const p=3.14

//Changing Values:
BoolVar=false;
b="Noori";
// p=100; We can't change the const if so it will show Error
console.log("Let ",BoolVar) //New Value
console.log("Var b= ",b) //New Value
console.log("Consr p=",p) //Const never be changed
26 changes: 26 additions & 0 deletions Assigments/Assigment#1/Q2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
let Std={
name: "Shahid Hussain",
fname: "Gulab Deen",
age: "19",
domicle: "GB",

}
const Result={
english: 80,
maths: 90,
urdu: 85,
sci: 95,

}
const Fee={
dues: 5000,
pay: false,
}
Object.freeze(Fee);
//Modification
console.log(Result)
Result.english=10;
console.log(Result)
//No Modifictaion in obj Fee
Fee.pay=true; //Will not able to modify
console.log(Fee)
16 changes: 16 additions & 0 deletions Assigments/Assigment#1/Q3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Array declared with let
let arr1 = [1, 2, 3];
arr1.push(4);
console.log(arr1); // [1, 2, 3, 4]

// Array declared with const
const arr2 = [5, 6, 7];
arr2.push(8); // Modification allowed
console.log(arr2); // [5, 6, 7, 8]

// Array declared with const but sealed to prevent modifications
const arr3 =[9, 10, 11];
Object.freeze(arr3);
// arr3.push(10); This will throw an error in strict mode

console.log(arr3); // [9, 10, 11]
18 changes: 18 additions & 0 deletions Assigments/Assigment#1/Q4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Object with data types
const person = {
name: "Shahid",
age: 20,
isStudent: true
};

// Convert object values to an array
const Array1 = Object.values(person);
console.log(Array1);

// Convert string values to uppercase
console.log(person.name.toUpperCase());

// Store Boolean value of object in a variable as string
const boolString =String(person.isStudent)
console.log(boolString); // "True"
console.log(typeof boolString); // "string"
6 changes: 6 additions & 0 deletions Assigments/Assigment#1/Q5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
let x = 5;
console.log(x++); // Post-increment, output: 5, x becomes 6
console.log(++x); // Pre-increment, output: 7

console.log(5 === '5'); // Strict equality, output: false
console.log(5 == '5'); // Loose equality, output: true
20 changes: 20 additions & 0 deletions Assigments/Assigment#1/Q6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Regular function
function add(a, b) {
return a + b;
}
console.log(add(2, 3)); // 5

// Arrow function
const multiply = (a, b) => a * b;
console.log(multiply(2, 3)); // 6

// Anonymous function
const subtract = function(a, b) {
return a - b;
};
console.log(subtract(5, 3)); // 2

// IIFE (Immediately Invoked Function Expression)
(function() {
console.log("IIFE executed");
})(); // "IIFE executed"
Empty file added Assigments/Assigment#1/Q7.js
Empty file.
128 changes: 128 additions & 0 deletions Assigments/ches.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chess Board</title>
<style>
.cont
{
height: 250px;
width: 250px;
border: 3px solid black;
}
.white
{
border: 1px solid;

/* color: white; */
background-color: white;
}
.brown
{

/* color: white; */
background-color: brown;
}
td
{
height: 30px;
width: 30px;
}



</style>
</head>
<body>
<div class="cont">
<table>
<tr>

<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
</tr>
<tr>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
</tr>
<tr>

<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
</tr>


<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
</tr>
<tr>

<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
</tr>
<tr>


<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>
<td class="white"></td>
<td class="brown"></td>

</table>




</div>



</body>
</html>
11 changes: 11 additions & 0 deletions JS/AsyncAwait/AsyncAwait.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
async function DisplayData() {
let myPromise = new Promise(function(resolve, reject) {
setTimeout(() => {
resolve("Hello from Amazon Server");
}, 2000);
});
let FullfilledPromise = await myPromise;
console.log(FullfilledPromise)
}

DisplayData();
22 changes: 22 additions & 0 deletions JS/AsyncAwait/AsyncAwaitPromises.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function helloWorld() {
return new Promise((resolve )=>{
setTimeout(() => {
resolve("Succesfull")
}, 3000);

});
}
async function Fun1() {
const msg = await helloWorld();
console.log("Message from function 1:", msg);
}
async function Fun2() {
const msg = await helloWorld();
console.log("Message from function 2:", msg);
}

Fun1()
Fun2()



18 changes: 18 additions & 0 deletions JS/AsyncAwait/Asynchronous.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function DsiplayMessage() {
return new Promise((resolve) => {
setTimeout(() => {
resolve("Hello World!");
}, 2000);
});
}
const FirstFunction =async function () {
const result =await DsiplayMessage();
console.log("FirstFunction :", result);
};
const SecondFunction = async () => {
const result = await DsiplayMessage();
console.log("SecondFunction :", result);
};

FirstFunction();
SecondFunction();
14 changes: 14 additions & 0 deletions JS/AsyncAwait/TryCatch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var myObject = {
name: "John Doe",
age: 15,
email: "test@test.com",
job: "Auditor",
};
try {
let userJSON = JSON.stringify(myObject);
console.log("JSON Data" ,userJSON);
let userObj = JSON.parse(myObject);
console.log("Object Data", userObj);
} catch (e) {
console.error(`Invalid data!`);
}
7 changes: 7 additions & 0 deletions JS/AsyncAwait/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Name": "Saqlain",
"FatherName": "Zaheer"
}


<Name>Saqlain</Name>
11 changes: 11 additions & 0 deletions JS/Destructuring/Array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const [first, last] = ["Nikola", "Tesla"];



let data = ["saqlain", 70, 432423, true];
const [name, age, ...others] = data

console.log(`Name : ${name} , Age : ${age}, Other Values :${others}`)

data.push("Shah")
console.log(`Data : ${data}`)
8 changes: 8 additions & 0 deletions JS/Destructuring/Default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const data = {
username: "saqlain",
age: 70,
isMale: true,
};
console.log("My Name is ",username);


10 changes: 10 additions & 0 deletions JS/Destructuring/destructuring.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@



const numbers = [1, 2, 3, 4, 5, 6];
console.log("numbers", numbers)
const [num1, num2, ...others] = numbers;
console.log("value", ...others)
const value = [num1, num2, ...others]

console.log("value", value)
17 changes: 17 additions & 0 deletions JS/Destructuring/object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
let { title, author } = {
title: "MERN Stack Course",
author: "Saqlain Shah",
};


let data = {
username:"saqlain",
Age: 70,
No:432423,
isMale: true
};
const {username, Age, ...abc} = data

console.log(`username : ${username} , Age : ${Age}, Other Values :${abc}`)

console.log(abc)
Loading