├── .github └── ISSUE_TEMPLATE │ └── feature_request.md ├── HTML-Tags-in-Javascript.html ├── JS-Alert-Box.html ├── JS-Arithmetic-Operators.html ├── JS-Array-Concat-&-Join.html ├── JS-Array-Filter.html ├── JS-Array-Includes.html ├── JS-Array-Methods.html ├── JS-Array-Pop-&-Push.html ├── JS-Array-Slice-&-Splice.html ├── JS-Array-Some-&-Every.html ├── JS-Array-Sort-&-Reverse.html ├── JS-Array-find-&-findIndex.html ├── JS-Array-index.html ├── JS-Array-of-Objects.html ├── JS-Arrays.html ├── JS-Assignment-Operators.html ├── JS-BOM-Introduction.html ├── JS-Break-&-Continue-Statement.html ├── JS-Children-Methods.html ├── JS-Comparison-Operators.html ├── JS-Conditional-Ternary-Operator.html ├── JS-Confirm-Box.html ├── JS-Const-Variable-with-Array-&-Objects.html ├── JS-Contains.html ├── JS-Create-Arrays-Method-II.html ├── JS-DOM-CSS-Styling-Methods.html ├── JS-DOM-Get-&-Set-Value-Methods.html ├── JS-DOM-Introduction.html ├── JS-DOM-Targeting-Methods.html ├── JS-DOM-querySelectors.html ├── JS-Data-Types.html ├── JS-Date-Methods.html ├── JS-Do-While-Loop.html ├── JS-Even-&-Odd-with-Loops.html ├── JS-Events.html ├── JS-For-Events-II.html ├── JS-For-Loop.html ├── JS-For-in-Loop.html ├── JS-Form-Events.html ├── JS-Functions-with-Parameters.html ├── JS-Functions-with-Return-Value.html ├── JS-Functions.html ├── JS-Global-&-Local-Variable.html ├── JS-If-Else-If-Statement.html ├── JS-If-Else-Statement.html ├── JS-If-Statement.html ├── JS-Implementation.html ├── JS-Logical-Operators.html ├── JS-Map-Method.html ├── JS-Math-Methods.html ├── JS-Modify-&-Delete-Array.html ├── JS-Multidimensional-Arrays.html ├── JS-Nested-Loop.html ├── JS-Number-Methods.html ├── JS-Objects-II.html ├── JS-Objects.html ├── JS-Prompt-Box.html ├── JS-String-Methods-II.html ├── JS-String-Methods.html ├── JS-Switch-Case.html ├── JS-Variables-Let.html ├── JS-Variables-constant.html ├── JS-Variables.html ├── JS-While-Loop.html ├── JS-Window-Height-&-Width.html ├── JS-Window-Open-&-Close.html ├── JS-Window-move.html ├── JS-addEventListener-Method.html ├── JS-appendChild-&-insertBefore.html ├── JS-classList-Methods.html ├── JS-cloneNode.html ├── JS-create-&-TextNode.html ├── JS-firstChild-&-lastChild-Method.html ├── JS-forEach-Loop.html ├── JS-has.html ├── JS-insert.html ├── JS-isArray.html ├── JS-isEqualNode.html ├── JS-nextSibling-&-prevSibling-Method.html ├── JS-parent-Method.html ├── JS-replaceChild-&-removeChild.html ├── JS-with-Google-Chrome-Console.html ├── JavaScript-Nested-Loop-II.html ├── LICENSE.txt ├── README.md ├── google899ab52cad8d25e1(1).html ├── images ├── Ascii code table.jpg ├── JS Conditional Ternary Operator 2.png ├── JS Conditional Ternary Operator.png ├── JavaScript If...else if statement.png ├── if-else-statment.png ├── javascript notes.png ├── js events 2.png ├── js events.png ├── js introduction.png └── js variable.png ├── index.html ├── introduction-js.html └── style.css /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /HTML-Tags-in-Javascript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | HTML Tags in Javascript 7 | 8 | 242 | 243 |

HTML TAGS IN JAVASCRIPT

244 |
<!DOCTYPE html>
248 | <html lang="en">
249 | <head>
250 |     <meta charset="UTF-8">
251 |     <meta name="viewport" content="width=device-width, initial-scale=1.0">
252 |     <meta http-equiv="X-UA-Compatible" content="ie=edge">
253 |     <title>JavaScript</title>
254 |     <script>
255 |         document.write("Hello World <br><br>");     
256 |         document.write("<i><b>Hello from Hamza Khan Lodhi<b></i>");
257 |     </script>
258 | </head>
259 | <body>
260 |     <h1>Hamza Khan Lodhi</h1>
261 | </body>
262 | </html>
263 |
264 |

Example

265 | 266 | 271 | 272 | -------------------------------------------------------------------------------- /JS-Alert-Box.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Alert Box 7 | 257 | 258 | 259 |

JavaScript alert()

260 |

261 | The alert() method in JavaScript is used to display a virtual alert box. 262 | It is mostly used to give a warning message to the users. It displays an 263 | alert dialog box that consists of some specified message (which is 264 | optional) and an OK button. When the dialog box pops up, we have to click 265 | "OK" to proceed. 266 |

267 |

268 | The alert dialog box takes the focus and forces the user to read the 269 | specified message. So, we should avoid overusing this method because it 270 | stops the user from accessing the other parts of the webpage until the box 271 | is closed. 272 |

273 |

Syntax

274 |
alert(message)
278 |

Values

279 |

280 | message: It is an optional string that specifies the text to display in 281 | the alert box. It consists of the information that we want to show to the 282 | users. 283 |

284 |
<!DOCTYPE html>
288 | <html>
289 | <head>
290 |   <title>JavaScript</title>
291 |   <script>
292 | 	var a = 40;
293 | 	var b = 20;
294 | 	
295 | 	if(a > b){
296 | 		alert(b + a);
297 | 	}else{
298 | 		alert("Value of B : " + b);
299 | 	}
300 |   </script>
301 | </head>
302 | <body>
303 | </body>
304 | </html>
305 | 306 | 309 | 310 | -------------------------------------------------------------------------------- /JS-Array-Filter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Array Filter 7 | 258 | 259 | 260 |

JS Array Filter

261 |
<!DOCTYPE html>
265 | <html>
266 | <head>
267 |   <title>JavaScript</title>
268 |   <script>
269 |     var ages = [10, 12, 19, 20];
270 | 	document.write(ages + "<br><br>");
271 | 	var b = ages.filter(checkAdult);
272 | 	document.write(b + "<br>");
273 | 
274 | 	function checkAdult(age) {
275 | 		return age >= 18;
276 | 	}
277 |   </script>
278 | </head>
279 | <body>
280 | </body>
281 | </html>
282 |
283 | 284 | 292 | 293 | -------------------------------------------------------------------------------- /JS-BOM-Introduction.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS BOM Introduction 7 | 386 | 387 | 388 |
389 |

Browser Object Model

390 | The Browser Object Model (BOM) is used to interact with the browser. The 391 | default object of browser is window means you can call all the functions of 392 | window by specifying window or directly. For example: window.alert("hello 393 | javatpoint"); is same as: alert("hello javatpoint"); You can use a lot of 394 | properties (other objects) defined underneath the window object like 395 | document, history, screen, navigator, location, innerHeight, innerWidth. 396 | 397 |

398 |
399 | The Window Object 400 |

401 | 402 |

403 | The window object is supported by all browsers. It 404 | represents the browser's window. 405 |

406 | 407 |

408 | All global JavaScript objects, functions, and variables automatically 409 | become members of the window object. 410 |

411 | 412 |

Global variables are properties of the window object.

413 | 414 |

Global functions are methods of the window object.

415 | 416 |

417 | Even the document object (of the HTML DOM) is a property of the window 418 | object: 419 |

420 | 421 |
window.document.getElementById("header");
425 | 
426 | 427 |

is the same as:

428 | 429 |
document.getElementById("header");
433 |
434 | 435 | 436 | -------------------------------------------------------------------------------- /JS-Conditional-Ternary-Operator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Conditional Ternary Operator 7 | 257 | 258 | 259 |

Ternary Operator:

260 |

261 | The “Question mark” or “conditional” operator in JavaScript is a ternary 262 | operator that has three operands. It is the simplified operator of 263 | if/else. 264 |

265 | 266 |
267 | 268 |
269 |

Examples:

270 |

Input: let result = (10 > 0) ? true : false; Output: true

271 |

Input: let message = (20 > 15) ? "Yes" : "No"; Output: Yes

272 |

Syntax:

273 |

condition ? value if true : value if false

274 | 287 |
<!DOCTYPE html>
291 | <html>
292 | <head>
293 |   <title>JavaScript</title>
294 |   <script>
295 |     var a = 100;
296 |     var b;
297 |     b = "Value is " + (a > 10 ? "True" : "False");
298 | 
299 |     document.write(b);
300 |   </script>
301 | </head>
302 | <body>
303 | </body>
304 | </html>
305 | 
306 | 307 | 308 | -------------------------------------------------------------------------------- /JS-Confirm-Box.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Confirm Box 7 | 257 | 258 | 259 |

JS Confirm Box

260 |

261 | JavaScript confirm method invokes a function that asks the user for a 262 | confirmation dialogue on a particular action. The confirm () method uses a 263 | window object to invoke a dialogue with a question and two option buttons, 264 | OK and Cancel. If the user selects the OK option, it will continue to the 265 | function execution; selecting the Cancel option will abort the block 266 | code's execution. 267 |

268 |

269 | It returns true if the user selects the OK option; otherwise, it returns 270 | false. 271 |

272 |

Syntax:

273 |
confirm("Select an Option!");
277 |

Parameters:

278 |

279 | It takes a "message" value in string format to display in the confirmation 280 | dialogue you want to show the user. 281 |

282 |

Return value:

283 |

284 | The confirm method returns a Boolean output, either true or false, if the 285 | OK is selected. 286 |

287 |

288 | A boolean indicating whether OK (true) or Cancel (false) was selected. If 289 | a browser ignores in-page dialogues, then the returned value is always 290 | false. 291 |

292 |
<!DOCTYPE html>
296 | <html>
297 | <head>
298 |     <title>JavaScript</title>
299 |     <script>
300 |         /* Confirm Box*/
301 |         var a = confirm ("Do you like our Website?");
302 | 
303 |         if (a) {
304 |             alert("Thanks");
305 |         } else {
306 |             alert("Sorry");
307 |         } 
308 |     </script>
309 | </head>
310 | <body>
311 | </body>
312 | </html>
313 | 314 | 317 | 318 | -------------------------------------------------------------------------------- /JS-Const-Variable-with-Array-&-Objects.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Const Variable with Array & Objects 7 | 258 | 259 | 260 |

JS Const Variable with Array & Objects

261 |
262 | 263 |

CONST ARRAYS

264 | 265 |

266 | The code above has an array variable called numbers holding three values. 267 | Even though the numbers array is a const you’re able to update or change 268 | the variable. For example, you can add another number to the numbers array 269 | by using the push method. Methods are actions you perform on the 270 | array or object.
271 |
272 | const numbers = [1,2,3];
273 | numbers.push(4);
274 | console.log(numbers) // Outpusts [1,2,3,4]; 275 |

276 | 277 |
278 |

CONST OBJECTS

279 | 280 |

281 | The modifying principle applies to an object for example.
282 |
283 | const user = {
284 |   name: "Gary",
285 | }
286 |
287 | user.age = 29
288 | console.log(user) // {name: "Gary", age: 29
289 |   290 |

291 | 292 |

293 | The code above creates a user object with a name property then it assigns 294 | a new age property to object. One thing to remember const does not stop 295 | array and objects from being modified it only stops the variable itself 296 | from being reassigned or being overwritten for example.
297 |
298 | const user = {
299 |   name: "Gary",
300 | }
301 |
302 | person = { name: "Bob" } // Uncaught TypeError: Assignment to constant 303 | variable.
304 |   305 |

306 | 307 |
<!DOCTYPE html>
311 | <html>
312 | <head>
313 |   <title>JavaScript</title>
314 |   <script>
315 |     const a = {
316 |       name : "Ram",
317 |       age : 25
318 |     };
319 | 
320 |     a.name = "Yahoo Baba";
321 |     a.age = 55;
322 |     console.log(a);
323 |   </script>
324 | </head>
325 | <body>
326 | </body>
327 | </html>
328 |
329 | 330 | 340 | 341 | -------------------------------------------------------------------------------- /JS-DOM-Introduction.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS DOM Introduction 7 | 258 | 259 | 260 |
261 |

The HTML DOM (Document Object Model)

262 | 263 |

264 | When a web page is loaded, the browser creates 265 | a Document Object Model 266 | of the page. 267 |

268 | 269 |

270 | The HTML DOM model is constructed as a tree 271 | of Objects:
272 |
273 | With the object model, JavaScript gets all the power it needs to create 274 | dynamic HTML: 275 |

276 | 277 | 286 | 287 |

What is the DOM?

288 | 289 |

The DOM is a W3C (World Wide Web Consortium) standard.

290 | 291 |

The DOM defines a standard for accessing documents:

292 | 293 |

294 | "The W3C Document Object Model (DOM) is a platform and language-neutral 296 | interface that allows programs and scripts to dynamically access and 297 | update the content, structure, and style of a document." 299 |

300 | 301 |

The W3C DOM standard is separated into 3 different parts:

302 | 303 | 308 | 309 |

What is the HTML DOM?

310 | 311 |

312 | The HTML DOM is a standard object model 313 | and programming interface for HTML. It defines: 314 |

315 | 316 | 332 |
333 | 334 | 335 | -------------------------------------------------------------------------------- /JS-Do-While-Loop.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Do While Loop 7 | 258 | 259 | 260 |

JS Do While Loop

261 |

262 | A do… while loop in JavaScript is a control statement in which the code is 263 | allowed to execute continuously based on a given boolean condition. It is 264 | like a repeating if statement. 265 |

266 |

267 | The do…while loop can be used to execute a specific block of code at least 268 | once. 269 |

270 |

Syntax:

271 |
do {
275 |     // Statements
276 | }
277 | while(conditions)
278 |

279 | The main difference between do…while and while loop is that it is 280 | guaranteed that do…while loop will run at least once. Whereas, the while 281 | loop will not run even once if the given condition is not satisfied. 282 |

283 |
<!DOCTYPE html>
287 | <html>
288 | <head>
289 |   <title>JavaScript</title>
290 |   <script>
291 |     var a = 1;
292 |     do{
293 |       document.write(a + " Hello Yahoo Baba<br>");
294 |       a++;
295 |     }while(a <= 10)
296 |   </script>
297 | </head>
298 | <body>
299 | </body>
300 | </html>
301 | 
302 | 303 | 310 | 311 | -------------------------------------------------------------------------------- /JS-Even-&-Odd-with-Loops.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Even & Odd with Loops 7 | 258 | 259 | 260 |

JS Even & Odd with Loops

261 |
<!DOCTYPE html>
265 | <html>
266 | <head>
267 |   <title>JavaScript</title>
268 |   <script>
269 |     for(var a = 1; a <= 10; a++){
270 |       if(a % 2 == 0){
271 |         document.write(a + "<br>");
272 |       }
273 |     }
274 |   </script>
275 | </head>
276 | <body>
277 | </body>
278 | </html>
279 | 280 | 290 | 291 | -------------------------------------------------------------------------------- /JS-For-Loop.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS For Loop 7 | 258 | 259 | 260 |

JS For Loop

261 |

The for statement creates a loop with 3 optional expressions:

262 |
for (expression 1; expression 2; expression 3)
266 | {
267 |        // code block to be executed
268 | }
269 |

270 | Expression 1 is executed (one time) before the execution of the code 271 | block. 272 |

273 |

Expression 2 defines the condition for executing the code block.

274 |

275 | Expression 3 is executed (every time) after the code block has been 276 | executed. 277 |

278 |
<!DOCTYPE html>
282 | <html>
283 | <head>
284 |   <title>JavaScript</title>
285 |   <script>
286 |     for(var x = 1; x <= 10; x++){
287 |        document.write("Hello Yahoo Baba <br>");
288 |     }
289 |   </script>
290 | </head>
291 | <body>
292 | </body>
293 | </html>
294 | 295 | 303 | 304 | -------------------------------------------------------------------------------- /JS-For-in-Loop.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS For in Loop 7 | 258 | 259 | 260 |
261 | For-in loop in JavaScript is used to iterate over the properties of an 262 | object. It can be a great debugging tool if we want to show the contents of 263 | an object. The for-in loop iterates only over those keys of an object which 264 | have their enumerable property set to “true”. The key values in an object 265 | have four attributes (value, writable, enumerable, and configurable). 266 | Enumerable when set to “true” means that we can iterate over that 267 | property.  268 |

269 |
270 | Syntax 271 |

272 | 273 |
 for (key in object) {
277 |        // code block to be executed
278 | }
279 | 280 |
<!DOCTYPE html>
284 | <html>
285 | <head>
286 |   <title>JavaScript</title>
287 |   <script>
288 |     var obj = {
289 |       firstName : "Yahoo",
290 |       lastName : "Baba",
291 |       Age : 25,
292 |       email : "hello@yahoobaba.net"
293 |     };
294 | 
295 |     for(var key in obj){
296 |       document.write(key + " : " + obj[key] + "<br>");
297 |     }
298 |   </script>
299 | </head>
300 | <body>
301 | </body>
302 | </html>
303 |
304 | 305 | 317 | 318 | -------------------------------------------------------------------------------- /JS-Nested-Loop.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Nested Loop 7 | 258 | 259 | 260 |

The nested for loop in JavaScript

261 |

262 | A simple for loop executes a specified number of times depending on the 263 | initialization value and the terminating condition. A nested for loop on 264 | the other hand, resides one or more for loop inside an outer for loop. 265 |

266 |

267 | In a nested loop the statement inside the for loop body is again a for 268 | loop. This causes The inside for loop to execute all the way through , for 269 | each iteration of the outer for loop. 270 |

271 |
for(let i = 0 ; i < limit; i++)
275 | {
276 |    for(let j = 0 ; j < limit; j++)
277 |    {
278 |       // statement
279 |    }
280 |    // statement for outer loop
281 | }
282 | 
283 |

284 | The inside loop in this example runs limit number of times for every 285 | iteration of the outer loop. So, in total, the loop runs limit x limit 286 | number of times. 287 |

288 |
<!DOCTYPE html>
292 | <html>
293 | <head>
294 |   <title>JavaScript</title>
295 |   <script>
296 |     for(var a = 1; a <= 5; a++){
297 |       for(var b = 1; b <= a ; b++){
298 |         document.write(a +  " ");
299 |       }
300 |       document.write("<br>");
301 |     }
302 |   </script>
303 | </head>
304 | <body>
305 | </body>
306 | </html>
307 | 308 | 316 | 317 | -------------------------------------------------------------------------------- /JS-Objects-II.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Objects - II 7 | 258 | 259 | 260 |

JS Objects - II

261 |
262 | 263 |
<!DOCTYPE html>
267 | <html>
268 | <head>
269 |   <title>JavaScript</title>
270 |   <script>
271 |     var person = new Object();
272 | 
273 | 	person.firstname = 'Ram';
274 | 	person.lastname = 'Kumar';
275 | 	person.age = 25;
276 | 
277 | 	document.write(person.firstname + "<br>");
278 | 	document.write(person.lastname + "<br>");
279 | 	document.write(person['age'] + "<br>");
280 |   </script>
281 | </head>
282 | <body>
283 | </body>
284 | </html>
285 |
286 | 287 | 293 | 294 | -------------------------------------------------------------------------------- /JS-Prompt-Box.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Prompt Box 7 | 257 | 258 | 259 |

JavaScript prompt() dialog box

260 |

261 | The prompt() method in JavaScript is used to display a prompt box that 262 | prompts the user for the input. It is generally used to take the input 263 | from the user before entering the page. It can be written without using 264 | the window prefix. When the prompt box pops up, we have to click "OK" or 265 | "Cancel" to proceed. 266 |

267 |

268 | The box is displayed using the prompt() method, which takes two arguments: 269 | The first argument is the label which displays in the text box, and the 270 | second argument is the default string, which displays in the textbox. The 271 | prompt box consists of two buttons, OK and Cancel. It returns null or the 272 | string entered by the user. When the user clicks "OK," the box returns the 273 | input value. Otherwise, it returns null on clicking "Cancel". 274 |

275 |

276 | The box is displayed using the prompt() method, which takes two arguments: 277 | The first argument is the label which displays in the text box, and the 278 | second argument is the default string, which displays in the textbox. The 279 | prompt box consists of two buttons, OK and Cancel. It returns null or the 280 | string entered by the user. When the user clicks "OK," the box returns the 281 | input value. Otherwise, it returns null on clicking "Cancel". 282 |

283 |

Syntax

284 |
prompt(message, default)
288 |

Values

289 |

The parameter values of this function are defined as follows.

290 |

291 | message: It is an optional parameter. It is the text displays to 292 | the user. We can omit this value if we don't require to show anything in 293 | the prompt. 294 |

295 |

296 | default: It is also an optional parameter. It is a string that 297 | contains the default value displayed in the textbox. 298 |

299 |
<!DOCTYPE html>
303 | <html>
304 | <head>
305 |   <title>JavaScript</title>
306 |   <script>
307 |     var a = prompt("What is your Name ?");
308 | 
309 |     document.write(a);
310 |   </script>
311 | </head>
312 | <body>
313 | </body>
314 | </html>
315 | 
316 | 317 | 320 | 321 | -------------------------------------------------------------------------------- /JS-Variables-Let.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS-Variables-Let 7 | 241 | 242 | 243 |

Const Variable:

244 |

Variables defined with const cannot be Redeclared

245 |

Variables defined with const cannot be Reassigned

246 |

Variables defined with const have Block Scope

247 |

Example:

248 |
<!DOCTYPE html>
252 | <html lang="en">
253 | <head>
254 |     <meta charset="UTF-8">
255 |     <meta name="viewport" content="width=device-width, initial-scale=1.0">
256 |     <meta http-equiv="X-UA-Compatible" content="ie=edge">
257 |     <title>JavaScript</title>
258 |     <script>
259 |         let z = "Hello World";
260 |         document.write(z);
261 |     </script>
262 | </head>
263 | <body>
264 | </body>
265 | </html>
266 | 267 | 274 | 275 | -------------------------------------------------------------------------------- /JS-Variables-constant.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Variables Constant 7 | 241 | 242 | 243 |

Constant Variable:

244 |

Variables defined with const cannot be Redeclared

245 |

Variables defined with const cannot be Reassigned

246 |

Variables defined with const have Block Scope

247 |
248 |

Example:

249 |
<!DOCTYPE html>
253 | <html lang="en">
254 | <head>
255 |     <meta charset="UTF-8">
256 |     <meta name="viewport" content="width=device-width, initial-scale=1.0">
257 |     <meta http-equiv="X-UA-Compatible" content="ie=edge">
258 |     <title>JavaScript</title>
259 |     <script>
260 |         const second = "Hello World";
261 |         document.write(second); 
262 |     </script>
263 | </head>
264 | <body>
265 | </body>
266 | </html>
267 | 268 | 272 | 273 | -------------------------------------------------------------------------------- /JS-Variables.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Variables 7 | 8 | 242 | 243 |

Variables are Containers for Storing Data

244 |

JavaScript Variables can be declared in 4 ways:

245 | 251 |
252 |

Var Keyword:

253 |

The var keyword was used in all JavaScript code from 1995 to 2015.

254 |

The let and const keywords were added to JavaScript in 2015.

255 |

256 | The var keyword should only be used in code written for older browsers. 257 |

258 |
259 |

Example:

260 |
<!DOCTYPE html>
264 | <html lang="en">
265 | <head>
266 |     <meta charset="UTF-8">
267 |     <meta name="viewport" content="width=device-width, initial-scale=1.0">
268 |     <meta http-equiv="X-UA-Compatible" content="ie=edge">
269 |     <title>JavaScript</title>
270 |     <script>
271 |         var x = "Hello";
272 |         var y = "World";
273 |         document.write(x + y);
274 |     </script>
275 | </head>
276 | <body>
277 | </body>
278 | </html>
279 | 280 | 287 | 288 | -------------------------------------------------------------------------------- /JS-While-Loop.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS While Loop 7 | 258 | 259 | 260 |

JS While Loop

261 |

262 | The while loop loops through a block of code as long as a specified 263 | condition is true. 264 |

265 |

Syntax

266 |
while (condition) 
270 | {
271 |     // code block to be executed
272 | }
273 |
<!DOCTYPE html>
277 | <html>
278 | <head>
279 |     <title>JavaScript</title>
280 |     <script>
281 |         /*Increase While Loop Condition */
282 |         var a = 1;
283 | 
284 |         while (a <= 10) {
285 |             document.write(a + ") Hello Yahoo Baba <br>");
286 |             a = a + 1;
287 |         }
288 | 
289 |         /*  Decrease While Loop Condition */
290 |         
291 |         var x = 10;
292 | 
293 |         while (x >= 1) {
294 |             document.write(x + ") Hello Yahoo Baba <br>");
295 |             x = x - 1;
296 |         }
297 |     </script>
298 | </head>
299 | <body>
300 | </body>
301 | </html>
302 | 303 | 304 | 313 | 314 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Hamza Khan Lodhi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JavaScript Notes 2 | 3 | ![JavaScript Notes](images/js%20introduction.png) 4 | ![JavaScript Notes](images/javascript%20notes.png) 5 | ![JavaScript Notes](images/js%20events%202.png) 6 | ![JavaScript Notes](images/js%20events.png) 7 | 8 | 🌐 **Live Demo**: [View Demo](https://hamzalodhi2023.github.io/javascript-notes/) 9 | 10 | --- 11 | 12 | ## Description 13 | 14 | Welcome to the JavaScript Notes project, your go-to resource for mastering JavaScript. This web application is built using HTML, CSS, and JavaScript to help developers of all levels learn and reference key JavaScript concepts. It's a testament to my passion for frontend development and commitment to making learning accessible and enjoyable. 15 | 16 | ### Key Features 17 | 18 | - 📚 An extensive collection of JavaScript topics and explanations. 19 | - 📝 Add your own notes and annotations. 20 | - 🌐 Responsive design for seamless learning on various devices. 21 | - 🚀 A project demonstrating my HTML, CSS, and JavaScript expertise. 22 | 23 | ## Technologies Used 24 | 25 | - HTML 26 | - CSS 27 | - JavaScript 28 | 29 | Feel free to explore the project, enhance your JavaScript skills, and contribute to this knowledge-sharing platform. It's my way of giving back to the developer community and making learning JavaScript a breeze. 30 | 31 | --- 32 | 33 | ## How to Contribute 34 | 35 | 1. **Fork** the repository to your GitHub account. 36 | 37 | 2. **Clone** the forked repository to your local machine: 38 | 39 | ```bash 40 | git clone https://github.com/yourusername/javascript-notes.git 41 | ``` 42 | 43 | Make changes or additions to the JavaScript notes. 44 | 45 | Push your changes to your GitHub repository. 46 | 47 | Submit a pull request to the original repository for review. 48 | 49 | Your contributions will help improve this valuable resource for fellow developers. 50 | 51 | ## Contact 52 | 53 | GitHub: hamzalodhi2023
54 | Email: hamzalodhi2023@gmail.com

55 | 📦 Thank you for exploring the JavaScript Notes project! Elevate your JavaScript skills and contribute to this open learning platform. 56 | -------------------------------------------------------------------------------- /google899ab52cad8d25e1(1).html: -------------------------------------------------------------------------------- 1 | google-site-verification: google899ab52cad8d25e1.html 2 | -------------------------------------------------------------------------------- /images/Ascii code table.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamzalodhi2023/javascript-notes/c2c5add94b8c9c59479ec46c9a5ddcf951986324/images/Ascii code table.jpg -------------------------------------------------------------------------------- /images/JS Conditional Ternary Operator 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamzalodhi2023/javascript-notes/c2c5add94b8c9c59479ec46c9a5ddcf951986324/images/JS Conditional Ternary Operator 2.png -------------------------------------------------------------------------------- /images/JS Conditional Ternary Operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamzalodhi2023/javascript-notes/c2c5add94b8c9c59479ec46c9a5ddcf951986324/images/JS Conditional Ternary Operator.png -------------------------------------------------------------------------------- /images/JavaScript If...else if statement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamzalodhi2023/javascript-notes/c2c5add94b8c9c59479ec46c9a5ddcf951986324/images/JavaScript If...else if statement.png -------------------------------------------------------------------------------- /images/if-else-statment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamzalodhi2023/javascript-notes/c2c5add94b8c9c59479ec46c9a5ddcf951986324/images/if-else-statment.png -------------------------------------------------------------------------------- /images/javascript notes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamzalodhi2023/javascript-notes/c2c5add94b8c9c59479ec46c9a5ddcf951986324/images/javascript notes.png -------------------------------------------------------------------------------- /images/js events 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamzalodhi2023/javascript-notes/c2c5add94b8c9c59479ec46c9a5ddcf951986324/images/js events 2.png -------------------------------------------------------------------------------- /images/js events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamzalodhi2023/javascript-notes/c2c5add94b8c9c59479ec46c9a5ddcf951986324/images/js events.png -------------------------------------------------------------------------------- /images/js introduction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamzalodhi2023/javascript-notes/c2c5add94b8c9c59479ec46c9a5ddcf951986324/images/js introduction.png -------------------------------------------------------------------------------- /images/js variable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hamzalodhi2023/javascript-notes/c2c5add94b8c9c59479ec46c9a5ddcf951986324/images/js variable.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | JS NOTES 11 | 12 | 13 | 14 |

JS NOTES

15 |
    16 |
  1. JS Introduction
  2. 17 |
  3. JS Implementation
  4. 18 |
  5. 19 | HTML Tags in Javascript 20 |
  6. 21 |
  7. JS Variables
  8. 22 |
  9. JS Variables (Let)
  10. 23 |
  11. JS Variables (Const)
  12. 24 |
  13. JS Data Types
  14. 25 |
  15. 26 | JS Arithmetic Operators 27 |
  16. 28 |
  17. 29 | JS Assignment Operators 30 |
  18. 31 |
  19. 32 | JS with Google Chrome Console 35 |
  20. 36 |
  21. 37 | JS Comparison Operators 38 |
  22. 39 |
  23. JS If Statement
  24. 40 |
  25. 41 | JS If Else If Statement 42 |
  26. 43 |
  27. 44 | JS Conditional Ternary Operator 47 |
  28. 48 |
  29. JS Switch Case
  30. 49 |
  31. JavaScript alert()
  32. 50 |
  33. JS Confirm Box
  34. 51 |
  35. JS Prompt Box
  36. 52 |
  37. JS Functions
  38. 53 |
  39. 54 | JS Functions with Parameters 57 |
  40. 58 |
  41. 59 | JS Functions with Return Value 62 |
  42. 63 |
  43. 64 | JS Global & Local Variable 65 |
  44. 66 |
  45. 67 | JS Events 68 |
  46. 69 |
  47. 70 | JS While Loop 71 |
  48. 72 |
  49. 73 | JS Do While Loop 74 |
  50. 75 |
  51. 76 | JS For Loop 77 |
  52. 78 |
  53. 79 | JS Break & Continue Statement 82 |
  54. 83 |
  55. 84 | JS Even & Odd with Loops 85 |
  56. 86 |
  57. 87 | JS Nested Loop 88 |
  58. 89 |
  59. 90 | JavaScript Nested Loop - II 91 |
  60. 92 |
  61. 93 | JS Arrays 94 |
  62. 95 |
  63. 96 | JS Create Arrays Method - II 99 |
  64. 100 |
  65. 101 | JS Multidimensional Arrays 102 |
  66. 103 |
  67. 104 | JS Modify & Delete Array 105 |
  68. 106 |
  69. 107 | JS Array Sort & Reverse 108 |
  70. 109 |
  71. 110 | JS Array Pop & Push 111 |
  72. 112 |
  73. 113 | JS Array Concat & Join 114 |
  74. 115 |
  75. 116 | JS Array Slice & Splice 117 |
  76. 118 |
  77. 119 | JS isArray 120 |
  78. 121 |
  79. 122 | JS Array indexof and last indexof 123 |
  80. 124 |
  81. 125 | JS Array Includes 126 |
  82. 127 |
  83. 128 | JS Array Some & Every 129 |
  84. 130 |
  85. 131 | JS Array find & findIndex 132 |
  86. 133 |
  87. 134 | JS Array Filter 135 |
  88. 136 |
  89. 137 | JS Array Methods 138 |
  90. 139 |
  91. 140 | JS forEach Loop 141 |
  92. 142 |
  93. 143 | JS Objects 144 |
  94. 145 |
  95. 146 | JS Objects - II 147 |
  96. 148 |
  97. 149 | JS Array of Objects 150 |
  98. 151 |
  99. 152 | JS Const Variable with Array & Objects 155 |
  100. 156 |
  101. 157 | JS For in Loop 158 |
  102. 159 |
  103. 160 | JS Map Method 161 |
  104. 162 |
  105. 163 | JS String Methods 164 |
  106. 165 |
  107. 166 | JS String Methods - II 167 |
  108. 168 |
  109. 169 | JS Number Methods 170 |
  110. 171 |
  111. 172 | JS Math Methods 173 |
  112. 174 |
  113. 175 | JS Math Methods 176 |
  114. 177 |
  115. 178 | JS Date Methods 179 |
  116. 180 |
181 |

DOM

182 |
    183 |
  1. 184 | JS DOM Introduction 185 |
  2. 186 |
  3. 187 | JS DOM Targeting Methods 188 |
  4. 189 |
  5. 190 | JS DOM Get & Set Value Methods 193 |
  6. 194 |
  7. 195 | JS DOM querySelectors 196 |
  8. 197 |
  9. 198 | JS DOM CSS Styling Methods 199 |
  10. 200 |
  11. 201 | JS addEventListener Method 202 |
  12. 203 |
  13. 204 | JS classList Methods 205 |
  14. 206 |
  15. 207 | JS parent Method 208 |
  16. 209 |
  17. 210 | JS Children Methods 211 |
  18. 212 |
  19. 213 | JS firstChild & lastChild Method 216 |
  20. 217 |
  21. 218 | JS nextSibling & prevSibling Method 221 |
  22. 222 |
  23. 223 | JS create & TextNode 224 |
  24. 225 |
  25. 226 | JS appendChild & insertBefore 229 |
  26. 230 |
  27. 231 | JS insert 232 |
  28. 233 |
  29. 234 | JS replaceChild & removeChild 237 |
  30. 238 |
  31. 239 | JS cloneNode 240 |
  32. 241 |
  33. 242 | JS Contains 243 |
  34. 244 |
  35. 245 | JS has 246 |
  36. 247 |
  37. 248 | JS isEqualNode 249 |
  38. 250 |
251 |

FORM EVENTS

252 |
    253 |
  1. JS Form Events
  2. 254 |
  3. JS Form Events - II
  4. 255 |
256 |

JS Browser BOM

257 |
    258 |
  1. JS BOM Introduction
  2. 259 |
  3. 260 | JS Window Height & Width 261 |
  4. 262 |
  5. 263 | JS Window Open & Close 264 |
  6. 265 |
  7. 266 | JS Window move 267 |
  8. 268 |
269 | 270 | 271 | -------------------------------------------------------------------------------- /introduction-js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | JS Introduction 7 | 12 | 13 | 14 |

What is JavaScript

15 |

16 | JavaScript (js) is a light-weight object-oriented programming language 17 | which is used by several websites for scripting the webpages. It is an 18 | interpreted, full-fledged programming language that enables dynamic 19 | interactivity on websites when applied to an HTML document. It was 20 | introduced in the year 1995 for adding programs to the webpages in the 21 | Netscape Navigator browser. Since then, it has been adopted by all other 22 | graphical web browsers. With JavaScript, users can build modern web 23 | applications to interact directly without reloading the page every time. 24 | The traditional website uses js to provide several forms of interactivity 25 | and simplicity. 26 |

27 | 28 |

29 | Although, JavaScript has no connectivity with Java programming language. 30 | The name was suggested and provided in the times when Java was gaining 31 | popularity in the market. In addition to web browsers, databases such as 32 | CouchDB and MongoDB uses JavaScript as their scripting and query language. 33 |

34 |
35 |

Features of JavaScript

36 |

There are following features of JavaScript:

37 |
    38 |
  1. 39 | All popular web browsers support JavaScript as they provide built-in 40 | execution environments. 41 |
  2. 42 |
    43 |
  3. 44 | JavaScript follows the syntax and structure of the C programming 45 | language. Thus, it is a structured programming language. 46 |
  4. 47 |
    48 | 49 |
  5. 50 | JavaScript is a weakly typed language, where certain types are 51 | implicitly cast (depending on the operation). 52 |
  6. 53 |
    54 | 55 |
  7. 56 | JavaScript is an object-oriented programming language that uses 57 | prototypes rather than using classes for inheritance. 58 |
  8. 59 |
    60 | 61 |
  9. It is a light-weighted and interpreted language.
  10. 62 |
    63 | 64 |
  11. It is a case-sensitive language.
  12. 65 |
    66 | 67 |
  13. 68 | JavaScript is supportable in several operating systems including, 69 | Windows, macOS, etc. 70 |
  14. 71 |
    72 | 73 |
  15. It provides good control to the users over the web browsers.
  16. 74 |
75 | 76 | 77 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | * { 2 | padding: 5px; 3 | margin: 0; 4 | box-sizing: border-box; 5 | font-family: Arial, Helvetica, sans-serif; 6 | } 7 | 8 | h1 { 9 | text-align: center; 10 | padding: 5%; 11 | } 12 | 13 | ol { 14 | /* border: 1px solid #000; */ 15 | width: 100%; 16 | height: 100%; 17 | 18 | display: flex; 19 | align-items: center; 20 | justify-content: space-evenly; 21 | flex-wrap: wrap; 22 | } 23 | 24 | li { 25 | /* border: 1px solid #000; */ 26 | width: 200px; 27 | height: 50px; 28 | text-align: center; 29 | margin: 20px; 30 | background-color: gray; 31 | } 32 | a { 33 | text-decoration: none; 34 | color: white; 35 | display: flex; 36 | align-items: center; 37 | justify-content: center; 38 | } 39 | --------------------------------------------------------------------------------