Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
494953f
Update my name
jawad-hussaini May 2, 2024
b50ef4a
this is index
jawad-hussaini May 3, 2024
fa1d97e
update my css file
jawad-hussaini May 3, 2024
35ab602
Merge branch 'NetbotsDotTech:main' into main
jawad-hussaini May 7, 2024
9fd8d28
added files
NetbotsDotTech May 15, 2024
8a70acc
added additional files
NetbotsDotTech May 15, 2024
7e9857f
Merge pull request #14 from jawad-hussaini/main
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
35d6b1a
added callback , promise and async await examples
NetbotsDotTech Jun 3, 2024
ca6bbbe
Merge branch 'main' of https://github.com/NetbotsDotTech/Web-Dev-Batch-1
NetbotsDotTech Jun 3, 2024
d16f7f9
updated branch
NetbotsDotTech Jun 3, 2024
36c8856
added fetch api example
NetbotsDotTech Jun 7, 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
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
35 changes: 35 additions & 0 deletions Assignment_js/Apis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

//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


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);
32 changes: 32 additions & 0 deletions Assignment_js/variables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//var variable
var name = "Nadeem";
console.log(name);

//var variable can be reinitialize and can be modify
var name = "Muhammad";
console.log(name);

//let variable

let num ;
num = 22
console.log(num);

//let variable can be modify but cannot reinitialize

num = 34
console.log(num);

//this line throw an error because we trying to reinitialize it
// let num = 33
// console.log(num)

//const variable

const value = 11;
console.log(value);

//const value cannot be reinitialize and cannot modify

// const value = 12 //throw an error
// console.log(value)
Loading