Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
0ca3ffa
login page
Muhammad-Nadeem786 May 9, 2024
8594772
new form
Muhammad-Nadeem786 May 9, 2024
6ed91ae
practice html file
Muhammad-Nadeem786 May 10, 2024
681f6f2
js program first
Muhammad-Nadeem786 May 15, 2024
23144a8
variable.js
Muhammad-Nadeem786 May 16, 2024
63a0555
arr.practie
Muhammad-Nadeem786 May 16, 2024
a38ce96
operators.js
Muhammad-Nadeem786 May 16, 2024
5053ec1
String method in js
Muhammad-Nadeem786 May 21, 2024
0eb0a86
function in js
Muhammad-Nadeem786 May 21, 2024
970db0d
Merge pull request #20 from Muhammad-Nadeem786/MN-3
NetbotsDotTech May 23, 2024
12df4f7
Array methods in javascript
Muhammad-Nadeem786 May 27, 2024
62eeb87
Rest operator in js
Muhammad-Nadeem786 May 28, 2024
820183d
object method
Muhammad-Nadeem786 May 28, 2024
9253b6d
object method
Muhammad-Nadeem786 May 28, 2024
80b6515
string method
Muhammad-Nadeem786 May 28, 2024
4a4d521
destructring in javascript
Muhammad-Nadeem786 May 29, 2024
fabd630
spread operator in js
Muhammad-Nadeem786 May 29, 2024
4d184c7
Amazone clone
Muhammad-Nadeem786 May 29, 2024
3fea769
Amazone clone html part
Muhammad-Nadeem786 May 29, 2024
283242a
Amazone clone css part
Muhammad-Nadeem786 May 29, 2024
87dbdb4
promises in js
Muhammad-Nadeem786 May 31, 2024
0fd2f95
Amazone clone completed
Muhammad-Nadeem786 May 31, 2024
329a191
Amazone clone has been done
Muhammad-Nadeem786 May 31, 2024
111cb17
spread operator in js
Muhammad-Nadeem786 Jun 3, 2024
7891d00
promises in jsvaScript
Muhammad-Nadeem786 Jun 3, 2024
e5e5481
variable in js task
Muhammad-Nadeem786 Jun 8, 2024
a7af59c
object in js task
Muhammad-Nadeem786 Jun 8, 2024
48e9d1a
arrays in ja task
Muhammad-Nadeem786 Jun 8, 2024
8acf011
function in js
Muhammad-Nadeem786 Jun 10, 2024
fbc3a9c
methods in js
Muhammad-Nadeem786 Jun 10, 2024
e0c3d68
operator in js
Muhammad-Nadeem786 Jun 10, 2024
2391759
rest spread and destructuring in js
Muhammad-Nadeem786 Jun 10, 2024
22fd457
operator in js
Muhammad-Nadeem786 Jun 10, 2024
a1ad9d6
Merge branch 'NetbotsDotTech:MN-3' into MN-3
Muhammad-Nadeem786 Jun 10, 2024
f2ed994
fetch api
Muhammad-Nadeem786 Jun 10, 2024
f3a465f
Merge branch 'main' into MN-3
NetbotsDotTech Jun 11, 2024
a27c59c
Merge pull request #28 from Muhammad-Nadeem786/MN-3
NetbotsDotTech Jun 11, 2024
7309602
Fetching Api
Muhammad-Nadeem786 Jun 11, 2024
3c80624
Fake Apis using callback,promises
Muhammad-Nadeem786 Jun 11, 2024
b0acc72
Merge branch 'MN-3' of https://github.com/Muhammad-Nadeem786/Web-Dev-…
Muhammad-Nadeem786 Jun 11, 2024
f2e307f
This is Dumy file
Muhammad-Nadeem786 Jun 11, 2024
9c4fcba
modified dumy.js
Muhammad-Nadeem786 Jun 12, 2024
e475fc6
vbdkfh
Muhammad-Nadeem786 Jun 14, 2024
f5c95e5
modify
Muhammad-Nadeem786 Jun 21, 2024
9f8afbc
modify
Muhammad-Nadeem786 Jun 21, 2024
0790d50
bfeh
Muhammad-Nadeem786 Jun 28, 2024
dd39be1
fjk
Muhammad-Nadeem786 Jul 1, 2024
5aebcb9
bsdjhf
Muhammad-Nadeem786 Jul 11, 2024
d451679
njkd
Muhammad-Nadeem786 Aug 9, 2024
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
62 changes: 62 additions & 0 deletions Assignment_js/Apis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

//callback function

// Define the dummy API endpoint
const apiEndpoint = "https://jsonplaceholder.typicode.com/users";

// Function to make the API call
function fetchData(callback) {
fetch(apiEndpoint)
.then(response => response.json())
.then(data => {
// Call the callback function with the data
callback(null, data);
})
.catch(error => {
// Call the callback function with the error
callback(error, null);
});
}

// Define a callback function to handle the response
function handleResponse(error, data) {
if (error) {
console.error("Error fetching data:", error);
} else {
console.log("Data fetched successfully:", data);
}
}

// Make the API call with the callback function
fetchData(handleResponse);

//promises
function fetchApi(){
let url = 'https://jsonplaceholder.typicode.com/todos/1'
console.log("fetching api 1.....")
return new Promise((resolve)=>{
setTimeout(() => {
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then((url)=>url.json())
.then((url)=>console.log(url.json))
resolve("resolve successfull...")
resolve();
}, 3000);
})
}

function fetchApi1(){
let url = 'https://jsonplaceholder.typicode.com/todos/2'
console.log("fetching api 2.....")
return new Promise((resolve)=>{
setTimeout(() => {
fetch('https://jsonplaceholder.typicode.com/todos/2')
.then((url)=>url.json())
.then((url)=>console.log(url.json))
resolve("resolve successfull...")
resolve();
}, 3000);
})
}


60 changes: 60 additions & 0 deletions Assignment_js/arrays.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//First array in we can change values and add attributes
var arr1 = [22,
true,
"Hello",
obj={
name : "Kashan",age: 34,cgpa:3.5,
}]
console.log(arr1);
// Add a new property to the object inside the array
arr1[3].grade = 'A';
console.log(arr1);
//change value of name
arr1[3].name = "ALI"
console.log(arr1)
arr1.push("New value")
console.log(arr1)


//Array second in which we are not able to add new value and cannot modify existing value
"use strict";
let arr2 = [22,
true,
"Hello",
{
name : "Kashan",
age: 34,
cgpa:3.5,
}];

Object.freeze(arr2[3]);
Object.freeze(arr2);
// arr1[3].grade = 'B'; //cannot modify
// arr1[3].name = "Muhammad" // cannot modify
console.log(arr2);

//Third arry in which we are able to add new attributes but cant modify the existing values

const arr3 = [
22,
true,
"Hello",
{
name: "Kashan",
age: 34,
cgpa: 3.5,
}
];
Object.defineProperty({},"name",{writable: false})
Object.defineProperty({},"age",{writable: false})
Object.defineProperty({},"cgpa",{writable: false})

arr3.push('Hello world'); //Adding new element in an array
console.log(arr3);

arr3[3].grade = "A"; //Adding new attributes in object inside array
console.log(arr3)

// arr3[3].age = 45; //This will throw an error we cannot modify existing value
// console.log(arr3);

47 changes: 47 additions & 0 deletions Assignment_js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//Different type function

function fun1 (x) {
for(let i = 0; i<=x; i++){
console.log(i);
}
}
fun1(5); //function call

//errow function

const fun2 = ((y)=>{
for(let j = 0; j<=y; j++){
if(j%2==0){
console.log("Even numbers are : ","\t",j);
}
}
})
fun2(10); //function call

//function which return some value

const fun3 = ((a,b)=>{
return(a+b);
})
let sum = fun3(3,4);
console.log("Sum : ",sum)

//forEach function for array

let arr = [1,2,3,4,5];
arr.forEach((val)=>{
console.log(val);
});

//callBack function

function calSum(r, s) {
return r + s;
}

function display(sum) {
console.log(sum);
}

let su = calSum(2, 3);
display(sum);
43 changes: 43 additions & 0 deletions Assignment_js/methd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//Object
let myObj = {
name: "Muhammad Nadeem",
age: 22,
isFollow: true,
percentage: 75.5,
newObj: {
remarks: true,
cgpa: 3.5,
institution: "Netbots"
}
};

console.log(myObj);

let arr = Object.values(myObj);
console.log(arr);

//try to pront dataType of boolean
console.log(typeof(myObj.isFollow));
//store a boolean value in a variable and print typeOf variable that is string
let follow = "true";
console.log(typeof(follow));
//Try to onvert all values in uppercase
console.log(myObj.name.toUpperCase());
console.log(myObj.newObj.institution.toUpperCase());//object inside object
//try to print all boolean value in an object
function collectBooleans(obj) {
let booleans = [];
for (let key in obj) {
if (typeof obj[key] === 'boolean') {
booleans.push(obj[key]);
} else if (typeof obj[key] === 'object' && obj[key] !== null) {
booleans = booleans.concat(collectBooleans(obj[key]));
}
}
return booleans;
}

let booleanValues = collectBooleans(myObj);
console.log(booleanValues);


67 changes: 67 additions & 0 deletions Assignment_js/objct.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//This object allow to add new attributes and modification of values
var student = {
name : "Ali",
age : 22,
remarks : true,
arr : [1,2,3,4],
obj : {a : 6, b : 7, c : 8, d : 9},
}
console.log(student);

student.newKey = "New key added in objct";
console.log(student);

student.age = 23 //modify age value
console.log(student);

student.arr.push(5,6); //add new value in array
console.log(student);

student.obj.e = 88; //add new key value pair in object
console.log(student);


//object two

//this object is freez we cannot modify the values and cannot add new attributes

"use strict";
let obj1 = Object.freeze({
name : "Nadeem",
age : 22,
remarks : true,
arr : [1,2,3,4],
obj : {a : 6, b : 7, c : 8, d : 9},
})

obj1.newKey = 'New value';//Here this key value is not added to the obj1 because the obj1 is freez and immutable
console.log(obj1)


//object 3

//This code allow to add new attributes in the object but cannot allow to modify the existing value

const student77 = {
name : "sajid",
age : 55,
arr : ['a','b','c','d'],
objct : {k:33,r:44,t:77}
}
Object.defineProperty(student77, "name", {writable: false});
Object.defineProperty(student77, "age", {writable: false});
Object.defineProperty(student77, "arr", {writable: false});
Object.defineProperty(student77, "objct", {writable: false});

student77.newKey = "newValue"; //adding new value
console.log(student77);

student77.name = "ali"; //cannot modify value
console.log(student77);







37 changes: 37 additions & 0 deletions Assignment_js/operator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//operator in js

//pre operator

let num = 5;
console.log(num);
++num;
console.log(++num); //increment before exicution
console.log(num++);//increment after exicution exicution
console.log(num)

console.log("**************************************************");

//post operator in js
let num2 = 11;
num2++;
console.log(num2++) //increment after exicution
console.log(num2);
console.log(++num2); //increment before exicution
console.log("**************************************************");

//Double equal only check value in this case same is print
let value = 10;
let str = "10";
if(value==str){
console.log("same");
}else{
console.log("Different");
}
//Triple equal check value as well as datatype in this case different is print
let val = 10;
let strng = "10";
if(value===str){
console.log("same");
}else{
console.log("Different");
}
60 changes: 60 additions & 0 deletions Assignment_js/rest_spread.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//Rest operator example 1

function myFunc(...values){
console.log(values);
}
myFunc(12,12,12);

//Example 2

function func2(...num) {
let sum = 0; // Initialize sum outside the loop

for (let i = 0; i < num.length; i++) {
sum = sum + num[i]; // Update sum with each element
}

console.log(sum);
}

func2(1, 2, 3, 4, 5);

//Spread operator

let arr1 = [1,2,3];
let arr2 = [4,5,6];
let arr3 = [...arr1,...arr2];
console.log(...arr3);

//Example 2

//spread operator on object

let obj1 = {a:1,b:2,c:3};
let obj2 = {d:4,e:5,f:6};
let obj3 = {...obj1,...obj2};
console.log(obj3);


//Destructring

let arr = [1,2,3,4,5];
let [a,b,...rest] = arr;
console.log(a);
console.log(b);
console.log(rest);
console.log(...arr);

//example 2

let obj = { name: "Nadeem", age: 22, hobbies: ["cricket", "football"] };
let { name, age, hobbies } = obj;
console.log(name);
console.log(age);
console.log(...hobbies);

//example 3

let arr6 = [1,5,7,9,5];
let [x,y,...val] = arr6;
console.log(x,y,val);
Loading