diff --git a/New Text Document.txt b/New Text Document.txt new file mode 100644 index 00000000..728a835f --- /dev/null +++ b/New Text Document.txt @@ -0,0 +1,13 @@ +Windows PowerShell +Copyright (C) 2015 Microsoft Corporation. All rights reserved. + +PS E:\Mernstack\Web-Dev-Batch-1> git pull +remote: Enumerating objects: 8, done. +remote: Counting objects: 100% (8/8), done. +remote: Compressing objects: 100% (8/8), done. +error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0 +error: 2551 bytes of body are still expected +fetch-pack: unexpected disconnect while reading sideband packet +fatal: early EOF +fatal: unpack-objects failed +PS E:\Mernstack\Web-Dev-Batch-1> \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 04f5d024..00000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# Osama diff --git a/asyn.js b/asyn.js new file mode 100644 index 00000000..96a10aaa --- /dev/null +++ b/asyn.js @@ -0,0 +1,52 @@ +// const getData1 = async () => { +// let data = "Hello World"; +// return data; +// } + +// getData1().then(data => console.log(data)); + +////////////////////////////////////////// +// const getData2 = async () => { +// let y = await "Hello World"; +// console.log(y); +// } + +// console.log(1); +// getData2(); +// console.log(2); +//////////////////////////////////////////////// + +// async function test() { + +// await console.log("A"); +// console.log("B"); +// await console.log("C"); + + +// } + +// console.log(" hello") +// test() + + +function asynchronous_operational_method() { + let first_promise = new Promise((resolve, reject) => resolve("Hello")); + + let second_promise = new Promise((resolve, reject) => { + setTimeout(() => { + resolve(" GeeksforGeeks.."); + }, 1000); + }); + + let combined_promise = Promise.all([first_promise, second_promise]); + return combined_promise; +} + +async function display() { + let data = await asynchronous_operational_method(); + console.log(data); +} + + + +display(); \ No newline at end of file diff --git a/cond.js b/cond.js new file mode 100644 index 00000000..1dc5d1fe --- /dev/null +++ b/cond.js @@ -0,0 +1,31 @@ + var hour=19 + +if (hour < 18) { + greeting = "Good day"; + console.log(greeting) + + } + else { + greeting = "Good evening"; + console.log(greeting) + } + let time=15; + + if (time < 10) { + greeting = "Good morning"; + console.log(greeting) + } + else if (time < 20) + { + greeting = "Good day"; + console.log(greeting) + } + else if (time = 15) + { + greeting = "Good half day"; + console.log(greeting) + } + + else { + greeting = "Good evening"; + } diff --git a/css_practice3.html b/css_practice3.html new file mode 100644 index 00000000..6c69b80e --- /dev/null +++ b/css_practice3.html @@ -0,0 +1,165 @@ + + + + +Example of Floating Elements + + + +

Flying Kites Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu sem tempor, varius quam at, luctus dui. Mauris magna metus, dapibus nec turpis vel, semper malesuada ante. Vestibulum id metus ac nisl bibendum scelerisque non non purus. Suspendisse varius nibh non aliquet sagittis. In tincidunt orci sit amet elementum vestibulum. Vivamus fermentum in arcu in aliquam. Quisque aliquam porta odio in fringilla. Vivamus nisl leo, blandit at bibendum eu, tristique eget risus. Integer aliquet quam ut elit suscipit, id interdum neque porttitor. Integer faucibus ligula.

+ + + + + + + +Example of CSS Relative Positioning + + + +
+
+

Relative Positioned Box

+
Note: The left margin edge of this DIV box is shifted to right by 100px from its original position. The whitespace generated is preserved.
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu sem tempor, varius quam at, luctus dui. Mauris magna metus, dapibus nec turpis vel, semper malesuada ante. Vestibulum id metus ac nisl bibendum scelerisque non non purus. Suspendisse varius nibh non aliquet sagittis. In tincidunt orci sit amet elementum vestibulum. Vivamus fermentum in arcu in aliquam. Quisque aliquam porta odio in fringilla. Vivamus nisl leo, blandit at bibendum eu, tristique eget risus. Integer aliquet quam ut elit suscipit, id interdum neque porttitor. Integer faucibus ligula.

+

Quis quam ut magna consequat faucibus. Pellentesque eget nisi a mi suscipit tincidunt. Ut tempus dictum risus. Pellentesque viverra sagittis quam at mattis. Suspendisse potenti. Aliquam sit amet gravida nibh, facilisis gravida odio. Phasellus auctor velit at lacus blandit, commodo iaculis justo viverra. Etiam vitae est arcu. Mauris vel congue dolor. Aliquam eget mi mi. Fusce quam tortor, commodo ac dui quis, bibendum viverra erat. Maecenas mattis lectus enim, quis tincidunt dui molestie euismod. Curabitur et diam tristique, accumsan nunc eu.

+
+ + + + + + + +Example of CSS Layers Effect + + + +
+
+
+
+
+ + + + + + + + + +Setting Text Alignment using CSS + + + +

This is a heading

+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu sem tempor, varius quam at, luctus dui. Mauris magna metus, dapibus nec turpis vel, semper malesuada ante. Vestibulum id metus ac nisl bibendum scelerisque non non purus. Suspendisse varius nibh non aliquet sagittis.

+ + + + + + + + +Example of Dynamic Anchor Pseudo-classes + + + +

Visit www.tutorialrepublic.com

+ + + +
+
+ + +
We'll never share your email with anyone else.
+
+
+ + +
+
+ + +
+ +
\ No newline at end of file diff --git a/destructre.js b/destructre.js new file mode 100644 index 00000000..34ac2c9f --- /dev/null +++ b/destructre.js @@ -0,0 +1,16 @@ +let a, b, rest; +[a, b] = [10, 20]; + +console.log(a); +// Expected output: 10 + +console.log(b); +// Expected output: 20 + +[a, b, ...rest] = [10, 20, 30, 40, 50]; + + +console.log(rest); +// Expected output: Array [30, 40, 50] + + diff --git a/foreach.js b/foreach.js new file mode 100644 index 00000000..38b95d66 --- /dev/null +++ b/foreach.js @@ -0,0 +1,27 @@ +// JavaScript to illustrate forEach() method +function func() { + + // Original array + const items = [12, 24, 36]; + const copy = []; + items.forEach(function (item) { + copy.push(item + item + 2); + }); + console.log(copy); + } + func(); + + + // JavaScript to illustrate forEach() method +function func() { + + // Original array + const items = [1, 4, 6]; + const copy = []; + items.forEach(function (item) { + copy.push(item * item); + }); + console.log(copy); + } + func(); + \ No newline at end of file diff --git a/fun.js b/fun.js new file mode 100644 index 00000000..a40b6e76 --- /dev/null +++ b/fun.js @@ -0,0 +1,62 @@ + +let hello=function(){ + console.log(" hello"); +} + +hello() + + + +//////add func //////////////// +function add(x,y) +{ + return(x+y) +} + +a=add(3,4) +console.log(a) + +//////sub function ///////////// +function sub(a,b) +{ + return(a-b) +} + +b=sub(8,9) +console.log(b) + +//////////////mul////// + +function mul(x,y,z) +{ + return(x*y*z) +} + +mul(2*3*4) + //////////// + + function add1(x,y) + { + console.log(x*y) + } + + add1(20,20) + +let add2=function(a,b) +{ + console.log(a+b) +} +add2(1,2) + +let add3=(x,y)=> +{ +console.log(x,y) +} +add3(80,90) + +const cars = new Array("Saab", "Volvo", "BMW"); +console.log(cars) + +const person = ["John", "Doe", 46]; +console.log(person) + diff --git a/function.js b/function.js new file mode 100644 index 00000000..1cc53ae4 --- /dev/null +++ b/function.js @@ -0,0 +1,51 @@ + +//////add func //////////////// +function add(x,y) +{ + return(x+y) +} + +a=add(3,4) +console.log(a) + +//////sub function ///////////// +function sub(a,b) +{ + return(a-b) +} + +b=sub(8,9) +console.log(b) + +//////////////mul////// + +function mul(x,y,z) +{ + return(x*y*z) +} +c=mul(2,3,4) +console.log(c) + + +// Function is called, the return value will end up in x +let x = myFunction(8, 3); + +function myFunction(a, b) { +// Function returns the product of a and b + return a * b; +} + +console.log(x) + +// Arrow function +//const multiply = (x, y) => x * y; + +//console.log(multiply) +//multiply(5,6) + + +let hello=function(){ + console.log(" hello"); +} + +hello() diff --git a/html_css_practice .html b/html_css_practice .html new file mode 100644 index 00000000..9a86783f --- /dev/null +++ b/html_css_practice .html @@ -0,0 +1,409 @@ + + + + + + + +

The background-attachment Property

+ +

The background-attachment property specifies whether the background image should scroll or be fixed (will not scroll with the rest of the page).

+ +

Tip: If you do not see any scrollbars, try to resize the browser window.

+ +

The background-image is fixed. Try to scroll down the page.

+

The background-image is fixed. Try to scroll down the page.

+

The background-image is fixed. Try to scroll down the page.

+

The background-image is fixed. Try to scroll down the page.

+

The background-image is fixed. Try to scroll down the page.

+

The background-image is fixed. Try to scroll down the page.

+

The background-image is fixed. Try to scroll down the page.

+

The background-image is fixed. Try to scroll down the page.

+

The background-image is fixed. Try to scroll down the page.

+ + + + + + + + + +

The border-style Property

+

This property specifies what kind of border to display:

+ +

A dotted border.

+

A dashed border.

+

A solid border.

+

A double border.

+

A groove border.

+

A ridge border.

+

An inset border.

+

An outset border.

+

No border.

+ +

A mixed border.

+ + + + + + + + + + + + + + + +

The border-color Property

+

This property specifies the color of the four borders:

+ +

A solid red border

+

A solid green border

+

A dotted blue border

+ +

Note: The "border-color" property does not work if it is used alone. Use the "border-style" property to set the borders first.

+ + + + + + + + + + + + +

The border-radius Property

+

This property is used to add rounded borders to an element:

+ +

Normal border

+

Round border

+

Rounder border

+

Roundest border

+ + + + + + + + + + + + +

Using individual margin properties

+ +
This div element has a top margin of 100px, a right margin of 150px, a bottom margin of 100px, and a left margin of 80px.
+ + + + + + + + + + + + +

Using individual padding properties

+ +
This div element has a top padding of 50px, a right padding of 30px, a bottom padding of 50px, and a left padding of 80px.
+ + + + + + + + + + + + +

Set the height and width of an element

+ +
This div element has a height of 200px and a width of 50%.
+ + + + + + + + + + + + +

Demonstrating the Box Model

+ +

The CSS box model is essentially a box that wraps around every HTML element. It consists of: borders, padding, margins, and the actual content.

+ +
This text is the content of the box. We have added a 50px padding, 20px margin and a 15px green border. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+ + + + + + + + + + + + +

Heading 1 (center)

+

Heading 2 (left)

+

Heading 3 (right)

+ +

The three headings above are aligned center, left and right.

+ + + + + + + + +Font Awesome Icons + + + + + + +

Font Awesome icon library

+ +

Some Font Awesome icons:

+ + + + + + +

Styled Font Awesome icons (size and color):

+ + + + + + + + + + + + + + + + +

Responsive Table

+

A responsive table will display a horizontal scroll bar if the screen is too +small to display the full content. Resize the browser window to see the effect:

+

To create a responsive table, add a container element (like div) with overflow-x:auto around the table element:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
First NameLast NamePointsPointsPointsPointsPointsPointsPointsPointsPointsPoints
JillSmith50505050505050505050
EveJackson94949494949494949494
AdamJohnson67676767676767676767
+
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/index.html b/index.html index a8acb8b1..5a8f0a3e 100644 --- a/index.html +++ b/index.html @@ -1,10 +1,5 @@ - - - - - Document - - - -dfdsfdsfdsds -fddg \ No newline at end of file + + + hello My first github project + + \ No newline at end of file diff --git a/jawad.txt b/jawad.txt deleted file mode 100644 index 35ddae82..00000000 --- a/jawad.txt +++ /dev/null @@ -1 +0,0 @@ -jawad \ No newline at end of file diff --git a/js.html b/js.html new file mode 100644 index 00000000..f5817aa0 --- /dev/null +++ b/js.html @@ -0,0 +1,291 @@ + + + + +

JavaScript Data Types

+ +

JavaScript has dynamic types. This means that the same variable can be used to hold different data types:

+ +

+ + + + + + + + + + + +

JavaScript Strings

+ +

You can use quotes inside a string, as long as they don't match the quotes surrounding the string:

+ +

+ + + + + + + + + + + +

JavaScript Numbers

+ +

Numbers can be written with, or without decimals:

+ +

+ + + + + + + + + + +

JavScript Bigint

+

A BigInt can not have decimals.

+ +

+ +

You cannot perform math between a BigInt type and a Number type.

+ + + + + + + + +

JavaScript Arrays

+ +

Array indexes are zero-based, which means the first item is [0].

+ +

+ + + + + + + + + + +

JavaScript Objects

+ +

+ + + + + + + + + +

JavaScript Operators

+

The typeof Operator

+

The typeof operator returns the type of a variable or an expression.

+ +

+ + + + + + + + + + + + + + + +

JavaScript Functions

+ +

Call a function which performs a calculation and returns the result:

+ +

+ + + + + + + + + + + + +

JavaScript Functions

+

Using a function as a variable:

+ +

+ + + + + + + + + + + +

JavaScript Objects

+ +

If you access an object method without (), it will return the function definition:

+ +

+ + + + + + + + + + + +

JavaScript HTML Events

+

The onclick Attribute

+ + + +

+ + + + + + + + +

JavaScript Strings

+

The slice() Method

+ +

The sliced (extracted) part of the string is:

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jsarray.js b/jsarray.js new file mode 100644 index 00000000..bd47647e --- /dev/null +++ b/jsarray.js @@ -0,0 +1,102 @@ +// Create and initialize an array +let courses = ["HTML", "CSS", "JavaScript", "React"]; + +// Display the array items +console.log(courses); + +// Create a new empty array +let newArray = []; + +// forEach loop to push elements +// into new array +courses.forEach(function (course) { + newArray.push(course); +}); + +// Display the new array of items +console.log(newArray); + +// Using elements +const array1 = new Array(1, 2, 3, 4, 5) + +// Using arrayLength +const array2 = new Array(10) + +console.log(array1); +console.log(array2) + +let arr = new Array("Geeks", "for", "Geeks"); +console.log("arr.length:" + arr.length); + +//// return array object +let myArr = Array.from("45878965412365"); +console.log(myArr); + + // Here the Array.of() method creates a new Array instance with + // a variable number of arguments, regardless of + // number or type of the arguments. + console.log(Array.of(0, 0, 0)); + console.log(Array.of(11, 21, 33)); + console.log(Array.of("Ram","Geeta")); + console.log(Array.of('geeksforgeeks')); + console.log(Array.of(2,3,4,'Sheeta')); + + const arr1 = [45, 32, 69, 21]; + const index = 3; + + console.log(arr1.at(index)); + + // JavaScript code for concat() method +function func() { + let num1 = [11, 12, 13], + num2 = [14, 15, 16], + num3 = [17, 18, 19]; + console.log(num1.concat(num2, num3)); +} +func(); + +// Input array +let array = [1, 2, 3, 4, 5, 6, 7]; + +// placing at index position 0 the element +// between index 3 and 6 +console.log("Array " + array.copyWithin(0, 3, 6)); + + +// JavaScript code for every() method +function isEven(element, index, array) { + return element % 2 === 0; +} +function func() { + let arr = [56, 92, 18, 88, 12]; + + // Check for even number + let value = arr.every(isEven); + console.log(value); +} +func(); + + +// input array contain some elements. +let array3 = [1, 2, 3, 4]; + +// Here array.fill function fills with 0 +// from position 2 till position 3. +console.log(array3.fill(0, 2, 4)); + +// input array contain some elements. +let array4 = [1, 2, 3, 4]; + +// Here array.fill function fills with 0 +// from position 2 till position 3. +console.log(array4.fill(0, 2, 4)); +// JavaScript to illustrate findIndex() method +function canVote(age) { + return age >= 18; +} + +function func() { + let filtered = [24, 33, 16, 40].filter(canVote); + console.log(filtered); +} +func(); diff --git a/mapfunc.js b/mapfunc.js new file mode 100644 index 00000000..4e039c32 --- /dev/null +++ b/mapfunc.js @@ -0,0 +1,16 @@ +const numbers = [2, 4, 6, 8, 10]; +const squareRoots = numbers.map(num => Math.sqrt(num)); + +console.log(squareRoots); // Output: [1, 2, 3, 4, 5] + + +// Input array +let arr = [4, 5, 6, 7, 8, 10]; + +// Using map to transform elements +let newArr = arr.map(function (val, index) { + return { key: index, value: val * val }; +}) + +// Display output +console.log(newArr) diff --git a/newFile.js b/newFile.js new file mode 100644 index 00000000..d6e2f8fb --- /dev/null +++ b/newFile.js @@ -0,0 +1,9 @@ +; diff --git a/obj.js b/obj.js new file mode 100644 index 00000000..55350c15 --- /dev/null +++ b/obj.js @@ -0,0 +1,14 @@ + +let detail={ + + title:"Mern stack", + auther:"sqlain", + + + } + + let {title:coursetitle, auther:name}=detail + + + console.log(coursetitle) + console.log(name) \ No newline at end of file diff --git a/objectmethods.js b/objectmethods.js new file mode 100644 index 00000000..86519942 --- /dev/null +++ b/objectmethods.js @@ -0,0 +1,107 @@ +// Initialize an object with properties and methods +const job = { + position: 'cashier', + type: 'hourly', + isAvailable: true, + showDetails() { + const accepting = this.isAvailable ? 'is accepting applications' : "is not currently accepting applications"; + + console.log(`The ${this.position} position is ${this.type} and ${accepting}.`); + } +}; + +// Use Object.create to pass properties +const barista = Object.create(job); + +barista.position = "barista"; +barista.showDetails(); + + +// Initialize an object +const employees = { + boss: 'Michael', + secretary: 'Pam', + sales: 'Jim', + accountant: 'Oscar' +}; + +// Get the keys of the object +const keys = Object.keys(employees); + +console.log(keys); + + + +// Initialize an object +const session = { + id: 1, + time: `26-July-2018`, + device: 'mobile', + browser: 'Chrome' +}; + +// Get all values of the object +const values = Object.values(session); + +console.log(values); + +// Initialize an object +const operatingSystem = { + name: 'Ubuntu', + version: 18.04, + license: 'Open Source' +}; + +// Get the object key/value pairs +const entries = Object.entries(operatingSystem); + +console.log(entries); + + + +// Initialize an object +const name = { + firstName: 'Philip', + lastName: 'Fry' +}; + +// Initialize another object +const details = { + job: 'Delivery Boy', + employer: 'Planet Express' +}; + +// Merge the objects +const character = Object.assign(name, details); + +console.log(character); + + +// Initialize an object +const user = { + username: 'AzureDiamond', + password: 'hunter2' +}; + +// Freeze the object +const newUser = Object.freeze(user); + +newUser.password = 'skardu'; +newUser.active = true; + +console.log(newUser); + + +// Initialize an object +const user1 = { + username: 'AzureDiamond', + password: 'hunter2' +}; + +// Seal the object +const newUser1 = Object.seal(user1); + +newUser1.password = 'india'; +newUser1.active = true; + +console.log(newUser1); \ No newline at end of file diff --git a/p1.html b/p1.html new file mode 100644 index 00000000..e03a2df7 --- /dev/null +++ b/p1.html @@ -0,0 +1,116 @@ + + + + +
+
+ +
+ +
+ Connect with friends and the + world around you on Facebook.
+ +
+ +
+ See photos and updates + from friends in News Feed +
+
+ +
+ +
+ Share what's new + in your life on your timeline +
+
+ +
+ +
+ Find more + of what you're looking for with graph search +
+
+ + +
+ +
+ +
It's free and always will be
+ +
+ + +
+
+ +
+
+ +
+
+ +
+
+
Birthday
+
+
+ + + + + + +
Why do I need to provide my birthday?
+
+ + + + + + +
+
+
+ By clicking Sign Up, you agree to our and that you have read our , including our . +
+
+
+ +
+
+
for a celebrity, band or business.
+
+
+
+
+ + \ No newline at end of file diff --git a/prac1.js b/prac1.js new file mode 100644 index 00000000..43496930 --- /dev/null +++ b/prac1.js @@ -0,0 +1,33 @@ + + + +// object +const trainee={ +Name:"ali", +age:20, +address:"skd", +} + +var person={ + + Name:"ahmad", + RollNo:44, + class:5 + +} + +console.log(person); + + + + +trainee.age=30; +console.log(trainee); + +//variable +const x= 40; +console.log(x) + +// after value change +//x=50; +console.log(x); \ No newline at end of file diff --git a/practice.html b/practice.html new file mode 100644 index 00000000..4c0effe5 --- /dev/null +++ b/practice.html @@ -0,0 +1,128 @@ +
+

Section in HTML

+

WWF

+

The World Wide Fund for Nature (WWF) is an international organization working on issues regarding the conservation, research and restoration of the environment, formerly named the World Wildlife Fund. WWF was founded in 1961.

+
+ +
+

WWF's Panda symbol

+

The Panda has become the symbol of WWF. The well-known panda logo of WWF originated from a panda named Chi Chi that was transferred from the Beijing Zoo to the London Zoo in the same year of the establishment of WWF.

+
+ +
+

WWF's Panda symbol

+

The Panda has become the symbol of WWF. The well-known panda logo of WWF originated from a panda named Chi Chi that was transferred from the Beijing Zoo to the London Zoo in the same year of the establishment of WWF.

+
+ +
+

Article in HTML

+

Google Chrome

+

Google Chrome is a web browser developed by Google, released in 2008. Chrome is the world's most popular web browser today!

+
+ +
+

Mozilla Firefox

+

Mozilla Firefox is an open-source web browser developed by Mozilla. Firefox has been the second most popular web browser since January, 2018.

+
+ +
+

Microsoft Edge

+

Microsoft Edge is a web browser developed by Microsoft, released in 2015. Microsoft Edge replaced Internet Explorer.

+
+ +
+
+

What Does WWF Do?

+

WWF's mission:

+
+

WWF's mission is to stop the degradation of our planet's natural environment, + and build a future in which humans live in harmony with nature.

+
+ + + + + + + + + + + + +

My family and I visited The Epcot center this summer. The weather was nice, and Epcot was amazing! I had a great summer together with my family!

+ + + +

My family and I visited The Epcot center this summer. The weather was nice, and Epcot was amazing! I had a great summer together with my family!

+

My family and I visited The Epcot center this summer. The weather was nice, and Epcot was amazing! I had a great summer together with my family!

+ + + +

The details element

+ +
+ Epcot Center +

Epcot is a theme park at Walt Disney World Resort featuring exciting attractions, international pavilions, award-winning fireworks and seasonal special events.

+
+ + + + + +W3.CSS + + + + + +
+

W3Schools Demo

+

Resize this responsive page!

+
+ +
+
+

London

+

London is the capital city of England.

+

It is the most populous city in the United Kingdom, + with a metropolitan area of over 13 million inhabitants.

+
+ +
+

Paris

+

Paris is the capital of France.

+

The Paris area is one of the largest population centers in Europe, + with more than 12 million inhabitants.

+
+ +
+

Tokyo

+

Tokyo is the capital of Japan.

+

It is the center of the Greater Tokyo Area, + and the most populous metropolitan area in the world.

+
+
+ + + + + + + \ No newline at end of file diff --git a/practice2.html b/practice2.html new file mode 100644 index 00000000..abbc9a90 --- /dev/null +++ b/practice2.html @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/promise.js b/promise.js new file mode 100644 index 00000000..b7ac630b --- /dev/null +++ b/promise.js @@ -0,0 +1,38 @@ +let p1= new Promise((resolve , reject)=> { + + + setTimeout(()=>{ + console.log('The first promise has resolved'); + resolve(10); + }, 1*1000 ); + }); + + +let p2 = new Promise((resolve ,reject)=> { + + setTimeout(() =>{ + + console.log('The second promise has resolved') + } , 2*1000) + }); + + + let p3 = new Promise((resolve ,reject)=> { + + setTimeout(() =>{ + + console.log('The third promise has resolved') + } , 3*1000) + }); + + + Promise.all([p1,p2,p3]).then((result)=>{ + console.log(`Results:${results}`); + }).catch((error)=>{ + console.log(`Error : ${error}`); + }); + + + + + diff --git a/restopr.js b/restopr.js new file mode 100644 index 00000000..2f867ba8 --- /dev/null +++ b/restopr.js @@ -0,0 +1,20 @@ + + +// function myFun(a, b, ...manyMoreArgs) { +// console.log("a", a); +// console.log("b", b); +// console.log("manyMoreArgs", manyMoreArgs); +// } + + // myFun("one", "two", "three", "four", "five", "six"); + + // a, "one" + // b, "two" + // manyMoreArgs, ["three", "four", "five", "six"] <-- an array + + let a1=[1,2,3,...4,5]; + let [a,b,c , ...rest]=a1 + let [e,f]=rest + console.log(rest) + console.log(a) + diff --git a/spread.js b/spread.js new file mode 100644 index 00000000..1d330117 --- /dev/null +++ b/spread.js @@ -0,0 +1,32 @@ +const user1 = { + name: 'Jen', + age: 22, +}; + +const user2 = { + name: "Andrew", + location: "Philadelphia" +}; + +const mergedUsers = { ...user1, ...user2 }; +console.log(mergedUsers); + + + + + + +// spread operator for copying +let arr = ['a', 'b', 'c']; +let arr2 = [...arr]; + +console.log(arr); +// [ 'a', 'b', 'c' ] + +arr2.push('d'); +//inserting an element at the end of arr2 + +console.log(arr2); +// [ 'a', 'b', 'c', 'd' ] +console.log(arr); +// [ 'a', 'b', 'c' ] diff --git a/string.js b/string.js new file mode 100644 index 00000000..332cbde7 --- /dev/null +++ b/string.js @@ -0,0 +1,23 @@ + +let text = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +let length = text.length; +console.log(length) + + +let text1 = "HELLO WORLD"; +let char = text.charAt(0); +console.log(char) + + +const name1 = "W3Schools"; +let letter = name1.at(2); +console.log(letter) + +let text2 = "Apple, Banana, Kiwi"; + +let part = text2.slice(7, 13); +console.log(part) + +let text3 = "Apple, Banana, Kiwi"; +let part3 = text3.slice(7); +console.log(part3) \ No newline at end of file diff --git a/style.css b/style.css deleted file mode 100644 index e0ee6198..00000000 --- a/style.css +++ /dev/null @@ -1,6 +0,0 @@ -*{ - background: none; -} -#body{ - background-image: none; -} \ No newline at end of file