├── Coding Guidelines └── Coding Guidlines.md ├── Exercises-And-Solutions ├── exercises │ ├── 01-basic-knowledge-exercise.md │ ├── 02-basic-knowledge-exercise.md │ ├── 03-basic-knowledge-exercise.md │ ├── 04-basic-knowledge-exercise.md │ ├── 05-basic-knowledge-exercise.md │ ├── 06-basic-knowledge-exercise.md │ ├── 07-loop-exercise.md │ ├── 08-github-exercise.md │ ├── 09-string-exercise.md │ ├── 10-basic-exercise.md │ ├── 11-basic-test-exercise.md │ ├── 12-basic-test-exercise.md │ ├── 13-array-exercise.md │ ├── 14-array-exercise.md │ ├── 15-object-exercise.md │ ├── 16-basic-test-exercise.md │ ├── 17-datastructures-exercise.md │ ├── 18-map-exercise.md │ ├── 19-call-apply-bind-exercise.md │ ├── 20-string-array-exercise.md │ ├── 21-date-number-exercise.md │ ├── 22-basic-test-exercise.md │ ├── 23-basic-test-exercise.md │ ├── 24-string-exercise.md │ └── 25-array-exercise.md └── solutions │ ├── 01-basic-knowledge-solution.md │ ├── 02-basic-knowledge-solution.md │ ├── 03-basic-knowledge-solution.md │ ├── 04-basic-knowledge-solution.md │ ├── 05-basic-knowledge-solution.md │ ├── 06-basic-knowledge-solution.md │ ├── 07-loop-solution.md │ ├── 08-github-solution.md │ ├── 09-string-solution.md │ ├── 10-basic-solution.md │ ├── 11-basic-test-solution.md │ ├── 12-basic-test-solution.md │ ├── 13-array-solution.md │ ├── 14-array-solution.md │ ├── 15-object-solution.md │ ├── 16-basic-test-solution.md │ ├── 17-datastructure-solution.md │ ├── 18-map-solution.md │ ├── 19-call-apply-bind-solution.md │ ├── 20-string-array-solution.md │ └── 21-date-number-solution.md ├── Git Notes ├── Git Commands In Hindi.md ├── Git-Cheatsheet by Atlassian.pdf ├── git-commands-english.md ├── linux-commands-english.md └── linux-commands-hindi.md ├── Interview-Questions-And-Answers ├── interview-questions-english.md └── interview-questions-hindi.md ├── LICENSE.md ├── README.md ├── Roadmap ├── Backend development roadmap.pdf └── Frontend development roadmap.pdf ├── SECURITY.md ├── Syllabus └── Syllabus.md ├── notes ├── English │ ├── 01-introduction-and-history.md │ ├── 02-features.md │ ├── 03-separation-of-concerns.md │ ├── 04-value_variable_datatype.md │ ├── 05-identifier.md │ ├── 06-comments.md │ ├── 07-statement.md │ ├── 08-use_strict.md │ ├── 09-let_const_var.md │ ├── 10-operators.md │ ├── 11-conditional_statement.md │ ├── 12-output.md │ ├── 13-typeconversion.md │ ├── 14-popupboxes.md │ ├── 15-other_operator.md │ ├── 16-truthy_falsy.md │ ├── 17-loop_and_switch.md │ ├── 18-string.md │ ├── 19-scope-scoping.md │ ├── 20-function.md │ ├── 21-More-About-functions.md │ ├── 22-hoisting.md │ ├── 23-temporal-dead-zone.md │ ├── 24-debugging.md │ ├── 25-number.md │ ├── 26-date.md │ ├── 27-DRY-principle.md │ ├── 28-Array.md │ ├── 29-Object.md │ ├── 30-Set.md │ ├── 31-Map.md │ ├── 32-Destructuring-Array.md │ ├── 33-Spread-operator.md │ ├── 34-Rest-parameter.md │ ├── 35-short-circuiting-nullish-coalescing-operator.md │ ├── 36-enhanced-object-literal.md │ ├── 37-Optional-chaining.md │ ├── 38-DOM.md │ ├── 39-BOM.md │ ├── 40-RegExp.md │ ├── 41-JSON-XML.md │ ├── 42-JavaScript-Engine.md │ ├── 43-Call-Stack.md │ ├── 44-Execution-Context.md │ ├── 45-Memory.md │ ├── 46-Compiler-Interpreter-JIT.md │ ├── 47-Event-Loop.md │ ├── 48-creation-code-phase.md │ ├── 49-this-keyword.md │ ├── 50-primitive-nonprimitive.md │ ├── 51-OOPs In JavaScript.md │ ├── 52-Prototypal-Inheritance.md │ ├── 53-Prototype.md │ ├── 54-Constructor function.md │ ├── 55-Es6 classes.md │ ├── 56-Object-create.md │ ├── 57-Encapsulation.md │ ├── 58-Chaining-methods.md │ ├── 59-Asynchronous-JavaScript.md │ ├── 60-Ajax.md │ ├── 61-About-API.md │ ├── 62-Web.md │ ├── 63-Promise.md │ ├── 64-fetch.md │ ├── 65-Consuming Promises.md │ ├── 66-Chaining Promises.md │ ├── 67-Rejected Promises.md │ ├── 68-Event Loop.md │ ├── 69-Creating-Promise.md │ ├── 70-Async-Await.md │ ├── 71-Try-catch.md │ ├── 72-Returning-values-from-Async.md │ ├── 73-Promises-In-Parallel.md │ ├── 74-Promises-Combinators.md │ ├── 75-Modules.md │ ├── 76-Export-Import-Modules.md │ ├── 77-Top-Level-Await.md │ ├── 78-Module-pattern.md │ ├── 79-Building-with-parcel.md │ ├── 80-Babel.md │ ├── 81-Transpiling.md │ └── 82-Polyfilling.md ├── Hindi │ ├── 01-introduction.md │ ├── 02-features.md │ ├── 03-separation-of-concerns.md │ ├── 04-value_variable_datatype.md │ ├── 05-identifier.md │ ├── 06-comments.md │ ├── 07-statement.md │ ├── 08-use_strict.md │ ├── 09-let_const_var.md │ ├── 10-operators.md │ ├── 11-conditional_statement.md │ ├── 12-output.md │ ├── 13-typeconversion.md │ ├── 14-popupboxes.md │ ├── 15-other_operator.md │ ├── 16-truthy_falsy.md │ ├── 17-loopand_switch.md │ ├── 18-string.md │ ├── 19-scoping_and_scope.md │ ├── 20-function.md │ ├── 21-More-About-functions.md │ ├── 22-destructuring.md │ ├── 23-temporal-dead-zone.md │ ├── 24-debugging.md │ ├── 25-number.md │ ├── 26-date.md │ ├── 27-DRY-principle.md │ ├── 28-array.md │ ├── 29-object.md │ ├── 30-set.md │ ├── 31-map.md │ ├── 32-Destructuring-Array.md │ ├── 33-Spread-operator.md │ ├── 34-Rest-parameter.md │ ├── 35-short-circuiting-nullish-coalescing-operator.md │ ├── 36-enhanced-object-literal.md │ ├── 37-Optional-chaining.md │ ├── 38-DOM.md │ ├── 39-BOM.md │ ├── 40-RegExp.md │ ├── 41-JSON-XML.md │ ├── 42-JavaScript-Engine.md │ ├── 43-Call-Stack.md │ ├── 44-Execution-Context.md │ ├── 45-Memory.md │ ├── 46-Compiler-Interpreter-JIT.md │ ├── 47-Event-Loop.md │ ├── 48-creation-code-phase.md │ ├── 49-Prototypal-Inheritance.md │ ├── 50-this-keyword.md │ ├── 51-OOPs.md │ ├── 52-Constructor function.md │ ├── 53-Object-create.md │ ├── 54-Chaining-methods.md │ ├── 55-primitive-nonprimitive.md │ ├── 56-Web.md │ ├── 57-Prototype.md │ ├── 58-Es6 classes.md │ ├── 59-Rejected Promises.md │ ├── 60-prototypal_inheritance.md │ ├── 61-Creating-Promise.md │ ├── 62-Ajax.md │ ├── 63-Try-catch.md │ ├── 64-Promise.md │ ├── 65-fetch.md │ ├── 66-Promises-Combinators.md │ ├── 67-Consuming Promises.md │ ├── 68-Chaining Promises.md │ ├── 69-Encapsulation.md │ ├── 70-Asynchronous-JavaScript.md │ ├── 71-Async-Await.md │ ├── 72-About-API.md │ ├── 73-Polyfilling.md │ ├── 74-Promises-In-Parallel.md │ ├── 75-Export-Import-Modules.md │ ├── 76-Top-Level-Await.md │ ├── 77-Module-pattern.md │ ├── 78-Building-with-parcel.md │ ├── 79-Babel.md │ ├── 80-Transpiling.md │ ├── 81-Returning-values-from-Async.md │ ├── 82-Modules.md │ └── 83-hoisting.md └── video-notes │ ├── Operators.md │ ├── console-notes.md │ ├── identifiers-comments.md │ ├── value-variable-datatypes.md │ ├── var-let-const │ └── var-let-const-differences.md └── star_us.gif /Exercises-And-Solutions/exercises/01-basic-knowledge-exercise.md: -------------------------------------------------------------------------------- 1 | # JavaScript Theory Test 2 | 3 | ### Question 1 4 | 5 | What is a programming language? 6 | 7 | ### Question 2 8 | 9 | What is a machine language? 10 | 11 | ### Question 3 12 | 13 | Why are different programming languages used for coding? 14 | 15 | ### Question 4 16 | 17 | Write about front-end and back-end languages names. 18 | 19 | ### Question 5 20 | 21 | What is front-end? 22 | 23 | ### Question 6 24 | 25 | What is back-end? 26 | 27 | ### Question 7 28 | 29 | What are the basic requirements for anyone who wants to become a front-end or back-end developer? 30 | 31 | ### Question 8 32 | 33 | What is the difference between a front-end developer and a designer? 34 | 35 | ### Question 9 36 | 37 | What is HTML? 38 | 39 | ### Question 10 40 | 41 | What is CSS and JavaScript? 42 | 43 | ### Question 11 44 | 45 | What is the role of HTML, CSS, and JavaScript? 46 | 47 | ### Question 12 48 | 49 | Where can we use JavaScript in programming? 50 | 51 | ### Question 13 52 | 53 | Please write about the history of JavaScript? 54 | 55 | ### Question 14 56 | 57 | Who invented JavaScript? 58 | 59 | ### Question 15 60 | 61 | What is ECMAScript? 62 | 63 | ### Question 16 64 | 65 | What are the famous JavaScript versions, and why? 66 | 67 | ### Question 17 68 | 69 | How can JavaScript be used in front-end and back-end development? 70 | 71 | ### Question 18 72 | 73 | What is a web browser? 74 | 75 | ### Question 19 76 | 77 | What is a website? 78 | 79 | ### Question 20 80 | 81 | What is a web page? 82 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/02-basic-knowledge-exercise.md: -------------------------------------------------------------------------------- 1 | ### Question 1 2 | 3 | Print numbers from 1 to 10 using the ++ operator. 4 | 5 | ### Question 2 6 | 7 | Print numbers from 10 to 1 using the -- operator. 8 | 9 | ### Question 3 10 | 11 | Check the output of the following expressions in the console: 12 | 13 | - 1+1 14 | - 1+200 15 | - 200+"300" 16 | - "learnjavascript" + 400 17 | 18 | ### Question 4 19 | 20 | Check the results of the following comparisons: 21 | 22 | - 2 === 2 23 | - 2 == "2" 24 | - 2 === +"2" 25 | - "learnjavascript" == "learnjavascript" 26 | - "LearnJavascript" == "learnjavascript" 27 | - 0.3 == 0.30 28 | - 1.0 == 1 29 | - 1.0 === 1 30 | 31 | ### Question 5 32 | 33 | Create 5 variables for your bank account details using let, const, and var. 34 | 35 | ### Question 6 36 | 37 | Write a code snippet and explain it using a multi-line comment. 38 | 39 | ### Question 7 40 | 41 | Explain the difference between a Process and a Thread. 42 | 43 | ### Question 8 44 | 45 | List the differences between let, const, and var. 46 | 47 | ### Question 9 48 | 49 | Provide one example for each of the following operators along with the expected output: 50 | 51 | ``` 52 | ** 53 | % 54 | != 55 | !== 56 | <= 57 | >= 58 | ``` 59 | 60 | ### Question 10 61 | 62 | In your own words, explain what JavaScript is in detail. 63 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/03-basic-knowledge-exercise.md: -------------------------------------------------------------------------------- 1 | ### Question 1 2 | 3 | Create a variable "marks" and assign any number. If the marks are greater than 60, then print "Pass," else print "Fail." 4 | 5 | ### Question 2 6 | 7 | Take two numbers and check if both numbers are odd or not. If they are both odd, then print "Odd," otherwise print "Even." 8 | 9 | ### Question 3 10 | 11 | Take four variables, "a," "b," "c," and "d," and assign their values in the following way: a = b, b = c, c = d, d = a. Check the output. 12 | 13 | ### Question 4 14 | 15 | Print the 2's table using the \*\* operator. Use any logic, but it should print the 2's table. 16 | 17 | ### Question 5 18 | 19 | Check the output of the following expressions and validate your answers: 20 | 21 | ``` 22 | 2+5*10-20**2 23 | 20/5*10+10 24 | ``` 25 | 26 | ### Question 6 27 | 28 | Take a number and check if the number is odd or not. If the number is odd, then print "Yes," else print "No." 29 | 30 | ### Question 7 31 | 32 | Take a number and check if the number is divisible by 10 and 5. If it is divisible, then print "Yes," else print "No." 33 | 34 | ### Question 8 35 | 36 | Take a number and check if multiplying the number by 20 makes it 100 or not. If it does, then print "Yes," else print "No." 37 | 38 | ### Question 9 39 | 40 | Calculate your 10th percentage and print "Pass" or "Fail." If the marks are more than 70, then print "Pass," else print "Fail." 41 | 42 | ### Question 10 43 | 44 | Take your age and check if your age is greater than 21. If it is, print "Adult," else print "Minor." 45 | 46 | ### Question 11 47 | 48 | Convert a if-else solution to ternary operator solution. So, instead of using if-else, use the ternary operator. 49 | 50 | ### Question 12 51 | 52 | Implement mark-sheet logic 53 | 54 | ``` 55 | Take a field "percentage" 56 | If percentage is >= 80 then print "Distinction" 57 | If percentage is >= 60 and < 80 then print "First division" 58 | If percentage >= 33 and < 60 then print "Second division" 59 | if percentage < 33 then print "Fail" 60 | ``` 61 | 62 | ### Question 13 63 | 64 | Write a logic to find the maximum of 2 numbers 65 | 66 | ### Question 14 67 | 68 | Write a logic to find maximum of 3 numbers 69 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/04-basic-knowledge-exercise.md: -------------------------------------------------------------------------------- 1 | ### Question 1 2 | 3 | Take two numbers and add a value that is the sum of the two numbers plus another number. Now, find the 3rd number. Write the logic. 4 | 5 | ### Question 2 6 | 7 | Ask the following questions: 8 | 9 | - What are your English marks in the 10th grade? 10 | - What are your Science marks in 10th grade? 11 | - What are your Math marks in 10th grade? 12 | - What are your Hindi marks in 10th grade? 13 | - What are your SST marks in 10th grade? 14 | 15 | Now calculate percentage by taking all the 5 subjects numbers. 16 | 17 | ### Question 3 18 | 19 | In which century were you born? Find out by asking for your birth year. Use the Math.floor function to remove the decimal portion of the century. 20 | 21 | ### Question 4 22 | 23 | - Add 20 to your name and check the value in the console. 24 | - Add true to your name and check the output. 25 | - Add 30 + "learnjavascript" and check the type of the final value. 26 | 27 | ### Question 5 28 | 29 | Create a Reverse Game. Ask any question with 2 possible answers. If the user selects the first option, then show the second option in an alert, and vice versa. 30 | 31 | For example: "Do you drink coffee or tea?" If the user says "coffee," then show "Tea" in an alert, and if the user says "tea," then show "coffee." 32 | 33 | ### Question 6 34 | 35 | Test the following conditions using &&, ||, and not logical operators. Take any number and check if the number is even and also check if the number is a multiple of 4 or not. If both conditions are true, then check if the number is less than 100 or equal to 84 or not. 36 | 37 | ### Question 7 38 | 39 | Take the city temperature. If the temperature is less than 10 degrees, then print "very cold." If the city temperature is less than 30 and greater than or equal to 10, then print "cold." If the temperature is between 30 and 40, then print "hot." Else, print "very hot". 40 | 41 | ### Question 8 42 | 43 | Using a prompt, ask the user about their age. If the age is greater than 18, then show the user a message, "Do you want to open an account?" If user click on "OK" button then ask the below 4 questions: 44 | 45 | - What is your name ? 46 | - What is your aaadhar number ? 47 | - What is your address? 48 | - What is your mobile number? 49 | Print all these details in the console. If user click on "Cancel" then show the message, "Sorry, please visit again." 50 | 51 | ### Question 9 52 | 53 | Create a simple calculator. Firstly, ask the user about the operation they want to perform, such as addition, subtraction, etc. After that, ask the user for the first number and then the second number. Finally, show the desired output. 54 | 55 | ### Question 10 56 | 57 | Who is the most intelligent in your family? Ask for the 10th-grade percentage of each family member and check who got the highest marks. If there are more than 4 family members, you can use the Math.max() function. 58 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/05-basic-knowledge-exercise.md: -------------------------------------------------------------------------------- 1 | ### Question 1 2 | 3 | Create two variables and assign some numbers in them. Now do below operations: 4 | 5 | - Addition 6 | - Multiplication 7 | - Substraction 8 | - Divide 9 | 10 | ### Question 2 11 | 12 | Take one number. If number is odd then print "odd" else print "even". 13 | 14 | ### Question 3 15 | 16 | Using prompt ask user to enter name and then show the name in alert. 17 | 18 | ### Question 4 19 | 20 | Take any two numbers. If first number is less than second number than print your name, age and mobile number else print your father name, age and mobile number. 21 | 22 | ### Question 5 23 | 24 | Take two numbers. Now using && and || operator check if both numbers are divisible of 5 && 10 or not. Also check both numbers are even or not. 25 | 26 | ### Question 6 27 | 28 | Print Hello world using console.log, window.alert and document.write. 29 | 30 | ### Question 7 31 | 32 | Take all the 6 falsy values and check in if condition for the verification. 33 | 34 | ### Question 8 35 | 36 | Using confirm box ask questions "Do you want to play?". if user click on `OK` button then print yes and if user click on `Cancel` then print No. 37 | 38 | ### Question 9 39 | 40 | If total members in your family are more than 5 then print "Big Family", if members are between 3 to 5 then print "Small family" else print "Very small family". 41 | 42 | ### Question 10 43 | 44 | Using ++, -- print 1 to 10 and then 10 to 5. 45 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/06-basic-knowledge-exercise.md: -------------------------------------------------------------------------------- 1 | # Github Exercise 2 | 3 | ### Question 1 4 | 5 | Create Github account and download Git bash for Windows. 6 | 7 | ### Question 2 8 | 9 | Create public repository with name JavaScriptTraining. 10 | 11 | ### Question 3 12 | 13 | Clone this repository in your laptop. 14 | 15 | ### Question 4 16 | 17 | Make below commits: 18 | 19 | - Commit to add new files. 20 | - Commit to modify new files. 21 | - Commit to delete one file. 22 | - Commit to add few more files. 23 | - Commit to rename some of the files. 24 | 25 | # Difference tables 26 | 27 | ### Question 1 28 | 29 | Create difference table of let, var and const. 30 | 31 | ### Question 2 32 | 33 | Create difference table of Process vs Thread. 34 | 35 | ### Question 3 36 | 37 | Create difference table of Compiler vs Interpreter vs JIT. 38 | 39 | ### Question 4 40 | 41 | Create difference table of Primitive vs Non Primitive. 42 | 43 | ### Question 5 44 | 45 | Create difference table of Number vs BigInt. 46 | 47 | ### Question 6 48 | 49 | Create difference table of With use strict vs without use strict. 50 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/08-github-exercise.md: -------------------------------------------------------------------------------- 1 | # Github Assignment 2 | 3 | ### Step 1 4 | 5 | Create a new Github repo with name "learnjavascript". 6 | 7 | ### Step 2 8 | 9 | Tick `.readme` checkbox while creating repo. 10 | 11 | ### Step 3 12 | 13 | In Description write "Training Repository". 14 | 15 | ### Step 4 16 | 17 | Now clone this repo locally on your laptop. 18 | 19 | ### Step 5 20 | 21 | Now open repo folder in gitbash or terminal. 22 | 23 | ### Step 6 24 | 25 | Add 3 new files index.html, style.css, script.js. 26 | 27 | ### Step 7 28 | 29 | Now add 5 commits: 30 | 31 | - In first commit add index.html 32 | - In second commit add style.css file 33 | - In third commit add script.js file 34 | - In fourth commit modify script.js file 35 | - In fifth commit delete style.css file 36 | 37 | ### Step 8 38 | 39 | Now create new branch. 40 | 41 | ### Step 9 42 | 43 | In new branch add 3 commits : 44 | 45 | - In first commit add style.css file 46 | - In second commit add other.html file 47 | - In third file modify index.html file 48 | 49 | ### Step 10 50 | 51 | Now verify changes in main branch and new branch. 52 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/09-string-exercise.md: -------------------------------------------------------------------------------- 1 | # Exercise-09 2 | 3 | ### Question 1 4 | 5 | ```javascript 6 | const str = "My name is learn javascript"; 7 | ``` 8 | 9 | Split this string using space and find length. 10 | 11 | ### Question 2 12 | 13 | Write a program to check if a string is palindrome or not? 14 | 15 | ### Question 3 16 | 17 | 9581444444 Convert to below 18 | 19 | ``` 20 | 95814***** 21 | *****44444 22 | 958**444** 23 | ``` 24 | 25 | ### Question 4 26 | 27 | Write a program to reverse a string. For example: 28 | 29 | ``` 30 | Hello -> olleH 31 | Bye -> eyB 32 | ``` 33 | 34 | ### Question 5 35 | 36 | Captialize first character of the String. For example: 37 | 38 | ``` 39 | learnjavascript -> Learnjavascript 40 | hello -> Hello 41 | ``` 42 | 43 | ### Question 6 44 | 45 | In a string convert uppercase character to lowercase and vice versa. 46 | 47 | ``` 48 | HeLlo -> hElLO 49 | leArNjavaScript -> LEaRnJAVAsCRIPT 50 | ``` 51 | 52 | ### Question 7 53 | 54 | Camelize the string. for example: 55 | 56 | ``` 57 | Hello World -> helloWorld 58 | my name is Sajid -> myNameIsSajid 59 | learn javascript -> learnJavascript 60 | ``` 61 | 62 | ### Question 8 63 | 64 | Count number of spaces in a string. 65 | 66 | ### Question 9 67 | 68 | Print below pattern using repeat function: 69 | 70 | ``` 71 | 1111111111 72 | 222222222 73 | 33333333 74 | 4444444 75 | 555555 76 | 66666 77 | 7777 78 | 888 79 | 99 80 | 0 81 | ``` 82 | 83 | ### Question 10 84 | 85 | "My name is Sajid Khan", take input from user and print whatever is there after the word. For example: 86 | 87 | ``` 88 | Hello learn javascript 89 | input: "rn" 90 | output: javascipt 91 | ``` 92 | 93 | ### Question 11 94 | 95 | Write differences between substring vs slice vs substr methods. 96 | 97 | ### Question 12 98 | 99 | What is Regex ? Give examples. 100 | 101 | ### Question 13 102 | 103 | Write difference between match vs search functions. 104 | 105 | ### Question 14 106 | 107 | Take a sentence using prompt box. In next question ask for a string and check if that string is present in that sentence or not. 108 | 109 | ### Question 15 110 | 111 | Take a string and if in that string anything is there other than the characters $, \_, number, a-z, A_Z then remove them from the string. Do it with regex and without regex. for example: 112 | 113 | ``` 114 | We%^%$Cod!@#e -> We$Code 115 | ``` 116 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/10-basic-exercise.md: -------------------------------------------------------------------------------- 1 | ### Question 1 2 | 3 | Create Bill Calculator. 4 | 5 | Ask below questions: 6 | 7 | 1. How many french fries (60rs per piece) do you want to order ? 8 | 2. How many burgers (50rs per piece) do you want to order ? 9 | 3. How many plates of chowmin (100rs per plate) do you want to order? 10 | 4. How many plates of Manchurian (80rs per plate) do you want to order? 11 | 5. How many Cokes (50 per piece) do you want to order ? 12 | 13 | Use can enter any number of quantities. Calculate the bill based on the quantities entered and item prices. If user enteres 0 or negative value then consider 14 | item count as 0. 15 | 16 | ### Question 2 17 | Print below Pattern: 18 | 19 | ``` 20 | $##$##$ 21 | $##$## 22 | $##$ 23 | $## 24 | $ 25 | ``` 26 | 27 | ### Question 3 28 | 29 | Ask the user question "How many times do you want to print Series". Then print below series. For example below series will be printed if user enteres 5 30 | 31 | `2, 6, 30, 260, 3130` 32 | 33 | Find the pattern for above series and print accordingly. If the user enters 10 then we will print the same series total 10 times. 34 | 35 | ### Question 4 36 | 37 | Using a switch case to do the below exercise: 38 | 39 | - If number is odd then print "Odd" 40 | - If number is even then print "Even" 41 | - If number is 100 then print "100" 42 | - Else print "10000" 43 | 44 | ### Question 5 45 | 46 | Ask user his/her birth year, "What is your birth year?" 47 | 48 | If user age is greater than 18 then ask user "Do you have valid license number?" 49 | If user click on "Okay" button then ask for his license number and finally in the alert show message "User with license number #### is ready to drive.". 50 | 51 | If user age is less than 18 then ask him question in confirm box "Do you have gaurdians?" 52 | If user says yes then ask his/her Gaurdian name and then in alert show "You are ready to drive with your #### (show gaurdian name here.)" 53 | Else show "Sorry visit again please." in alert box 54 | 55 | ### Question 6 56 | 57 | Take any number and take other number as 19. Now check their difference by subtracting each other. If both numbers difference is greater than 19 then print triple their absolute difference else print the double of their absolute difference. 58 | 59 | ### Question 7 60 | 61 | Write a JavaScript program to check from two given integers, whether one is positive and another one is negative. 62 | 63 | If "yes" then print sum of both the numbers 64 | Else print multiplication of both numbers 65 | 66 | ### Question 8 67 | 68 | Write a JavaScript program to check if out of 4 numbers any of two numbers are same or not. If yes then print "Yes" else print "No". 69 | 70 | ### Question 9 71 | 72 | Write a program to check if a number is palindrome or not. It means 141 and 12221 both are examples of palindrome number. If number is palindrome then print "yes' else print "no". 73 | 74 | ### Question 10 75 | 76 | Take a String and check its length. If string length is greater than 10 then print from 1 to length of the string else print No. 77 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/11-basic-test-exercise.md: -------------------------------------------------------------------------------- 1 | ### Question 1 2 | 3 | Write a javaScript function to capitalize the first character of the string. For example: 4 | 5 | ``` 6 | allenacademy 7 | 8 | //output: 9 | Allenacademy 10 | ``` 11 | 12 | ### Question 2 13 | 14 | Write a javaScript function to insert a string within a string at a particular position. For example: 15 | 16 | ``` 17 | We are learning exercises. 18 | 19 | //now insert the word JavaScript at 14 position so output will be : 20 | 21 | We are learning JavaScript exercises. 22 | ``` 23 | 24 | ### Question 3 25 | 26 | Write a JavaScript function to count the occurrence of a substring in a string. 27 | 28 | ``` 29 | "My name is allen academy and my friend name is Arun Kumar." 30 | 31 | //find count of 'is' in this word is 2. 32 | ``` 33 | 34 | ### Question 4 35 | 36 | Ask user below questions: 37 | 38 | 1. What is your name? 39 | 2. What is your mobile number? 40 | 3. What is your account number? 41 | 4. What is your atm card number? 42 | 5. What is your aadhar number? 43 | 44 | Now do below tasks: 45 | 46 | 1. Mask last 3 digits of the mobile number. 47 | 2. Mask middle of 5 numbers of the account. 48 | 3. Mask last 8 digit of atm card number. 49 | 4. Mask starting 4 digits and last 4 digits of aadhar number. 50 | 51 | ### Question 5 52 | 53 | Print below pattern using repeat function: 54 | 55 | ``` 56 | $ 57 | $$$ 58 | $$$$$ 59 | $$$$$$$ 60 | $$$$$$$$$ 61 | $$$$$$$$$$$ 62 | ``` 63 | 64 | ### Question 6 65 | 66 | Ask below questions : 67 | 68 | 1. What is your name? 69 | 2. What is your birth year? 70 | 3. What is your address ? 71 | 4. What is your country code? 72 | 5. What is your mobile number? 73 | 74 | Now using string template literal syntax show below output based on your answer: 75 | 76 | `My name is Sajid Khan. I was born in 1993 and my current age is 30 years. My address is Jhotwara, Jaipur and my mobile number is +91956546565456`. 77 | 78 | ### Question 7 79 | 80 | Divide a string in two part. Now in right side part of string add "Hello" in the end. In left side of the string add "World" in starting. For example: 81 | 82 | ``` 83 | let str = "Allen Academy" 84 | 85 | //output: 86 | Allen Hello World Academy 87 | ``` 88 | 89 | ### Question 8 90 | 91 | Guessing Game. Ask user what character is present at particular index in a word. If user guess is right then show him Congrulations message otherwise show Sorry message. For example: 92 | 93 | ``` 94 | Allen Academy 95 | 96 | What is the character you are guessing? A 97 | What is the index? 3 98 | 99 | Sorry 100 | ``` 101 | 102 | ### Question 9 103 | 104 | Print pattern using repeat function: 105 | 106 | ``` 107 | *********** 108 | ********* 109 | ******* 110 | ***** 111 | *** 112 | * 113 | ``` 114 | 115 | ### Question 10 116 | 117 | Print below series using repeat function: 118 | 119 | ``` 120 | 1 224 3339 44412 555520 121 | ``` 122 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/13-array-exercise.md: -------------------------------------------------------------------------------- 1 | # Array Questions 2 | 3 | ### Question 1 4 | 5 | Create an array with three elements and print out the second element. 6 | 7 | ### Question 2 8 | 9 | Create an array with five elements and print out the length of the array. 10 | 11 | ### Question 3 12 | 13 | Create an array with four elements and print out each element using a for loop. 14 | 15 | ### Question 4 16 | 17 | Create an array with six elements and print out each element using a forEach loop. 18 | 19 | ### Question 5 20 | 21 | Create an array with three elements and add a fourth element to the end of the array. 22 | 23 | ### Question 6 24 | 25 | Create an array with four elements and remove the second element. 26 | 27 | ### Question 7 28 | 29 | Create an array with five elements and remove the last element. 30 | 31 | ### Question 8 32 | 33 | Create an array with three elements and check if the array includes a specific value. 34 | 35 | ### Question 9 36 | 37 | Create an array with five elements and sort the array in ascending order. 38 | 39 | ### Question 10 40 | 41 | Create an array with five elements and sort the array in descending order. 42 | 43 | ### Question 11 44 | 45 | Create two arrays, concatenate them and print out the resulting array. 46 | 47 | ### Question 12 48 | 49 | Create an array with three elements and convert it to a string. 50 | 51 | ### Question 13 52 | 53 | Create an array with four elements and reverse the order of the elements. 54 | 55 | ### Question 14 56 | 57 | Create an array with five elements and find the index of a specific value. 58 | 59 | ### Question 15 60 | 61 | Create an array with six elements and slice the array to create a new array with the first three elements. 62 | 63 | ### Question 16 64 | 65 | Create an array with six elements and use the map method to double each element. 66 | 67 | ### Question 17 68 | 69 | Create an array with four elements and use the while loop to calculate the sum of all elements. 70 | 71 | ### Question 18 72 | 73 | Create an array with five elements and use the filter method to return only the even numbers. 74 | 75 | ### Question 19 76 | 77 | Create an array with three elements and use the join method to concatenate the elements with a dash (-) separator. 78 | 79 | ### Question 20 80 | 81 | Create two arrays with three elements each and use the concat method to combine them into a new array. 82 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/14-array-exercise.md: -------------------------------------------------------------------------------- 1 | ## Array Exercise 2 | 3 | 1. Create an array called fruits that contains the following elements: "apple", "banana", "orange". Now check if "orange" is in the fruits array. 4 | 5 | 2. Given an array of numbers, write a function that returns the sum of all the even numbers in the array. 6 | 7 | 3. Given two arrays of numbers, write a function that returns a new array that contains only the unique elements from both arrays. 8 | 9 | 4. Given an array of strings, write a function that returns the longest string in the array. 10 | 11 | 5. Write a function that takes an array of numbers and returns the largest number in the array. 12 | 13 | 6. Write a function that takes an array of numbers and returns a new array that only contains the even numbers from the original array. 14 | 15 | 7. Write a function that takes an array of strings and returns a new array that only contains strings with more than 5 characters. 16 | 17 | 8. Write a function that takes two arrays of numbers and returns a new array that contains the intersection of the two arrays (i.e. only the numbers that appear in both arrays). 18 | 19 | 9. Write a function that takes an array of numbers and returns a new array where each element is the square of the original element 20 | 21 | 10. Write a function that takes an array of numbers and returns the average of all the numbers in the array. 22 | 23 | 11. Write a function that takes an array of numbers and returns a new array that only contains numbers that are greater than 5. Use filter function 24 | 25 | 12. Write a function that takes an array of numbers and returns a new array where each element is the original element plus 1. use map function 26 | 27 | 13. Write a function that takes an array of numbers and returns a new array that contains only the unique numbers using reduce. 28 | 29 | 14. Write a function that takes an array of strings and returns the total number of characters in all the strings using reduce. 30 | 31 | 15. Write a function that takes an array of strings and sorts them by their length in ascending order. 32 | 33 | ``` 34 | // Example usage 35 | let strings = ["apple", "banana", "cherry", "date"]; 36 | console.log(sortStringsByLength(strings)); // Output: ["date", "apple", "cherry", "banana"] 37 | ``` 38 | 39 | 16. Write a function that takes an array of numbers and returns the second highest number. 40 | 41 | 17. Write a function that takes an array of numbers and returns a new array with all the unique numbers. 42 | 43 | 18. Write a function that takes an array of strings and returns a new array with only the strings that contain the letter "a". 44 | 45 | 19. Write a function that takes an array of numbers and returns a new array with the numbers sorted in ascending order. 46 | 47 | 20. Write a function that takes an array of strings and flattens each string into an array of characters, then flattens the result into a single array. 48 | 49 | ``` 50 | // Example usage 51 | let arr = ['hello', 'world']; 52 | console.log(flattenStrings(arr)); // Output: ['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd'] 53 | ``` 54 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/15-object-exercise.md: -------------------------------------------------------------------------------- 1 | ## Object Questions 2 | 3 | ### Question 1 4 | 5 | What is an object in JavaScript? 6 | 7 | ### Question 2 8 | 9 | What is the difference between dot notation and bracket notation for accessing object properties? 10 | 11 | ### Question 3 12 | 13 | How do you loop through the properties of an object in JavaScript? 14 | 15 | ### Question 4 16 | 17 | What is the difference between an object and an array in JavaScript? 18 | 19 | ### Question 5 20 | 21 | Write a JavaScript function to convert an object into a list of `[key, value]` pairs. 22 | 23 | ### Question 6 24 | 25 | Write a function that takes an object representing a person and returns their full name. 26 | 27 | ### Question 7 28 | 29 | Create an Object with your personal details. Now print all the keys of the object in ascending order. 30 | 31 | ### Question 8 32 | 33 | Create an Object with your personal details. Now filter out all the values of the object and show them in descending order. 34 | 35 | ### Question 9 36 | 37 | Create an object to hold information on your favorite recipe. It should have properties for title (a string), servings (a number), and ingredients (an array of strings). 38 | On separate lines (one console.log statement for each), log the recipe information so it looks like: 39 | Mole 40 | Serves: 2 41 | Ingredients: 42 | cinnamon 43 | cumin 44 | cocoa 45 | 46 | ### Question 10 47 | 48 | Create a JavaScript function inside an object which finds max of 3 numbers. Now call this function of the object and print the maximum number. 49 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/16-basic-test-exercise.md: -------------------------------------------------------------------------------- 1 | # Exericse 16 2 | 3 | ### Question 1 4 | 5 | Write a JavaScript program to check whether a string "Code" presents at 5th (index 4) position in a given string, if "Code" presents in the string return the string without "Code" otherwise return the original one. 6 | 7 | ### Question 2 8 | 9 | Write a JavaScript program to capitalize the first letter of each word of a given string. 10 | 11 | ``` 12 | Example string : 'the quick brown fox' 13 | Expected Output : 'The Quick Brown Fox' 14 | ``` 15 | 16 | ### Question 3 17 | 18 | Write a JavaScript program to check whether all the digits in a given number are the same or not. 19 | 20 | ### Question 4 21 | 22 | Write a JavaScript function that reverse a number. 23 | 24 | ### Question 5 25 | 26 | Write a JavaScript function to extract unique characters from a string. 27 | 28 | ``` 29 | Example string : "thequickbrownfoxjumpsoverthelazydog" 30 | Expected Output : "thequickbrownfxjmpsvlazydg" 31 | ``` 32 | 33 | ### Question 6 34 | 35 | Write a JavaScript function to chop a string into chunks of a given length. 36 | Test Data : 37 | 38 | ``` 39 | console.log(string_chop('w3resource')); 40 | console.log(string_chop('w3resource',2)); 41 | console.log(string_chop('w3resource',3)); 42 | ["w3resource"] 43 | ["w3", "re", "so", "ur", "ce"] 44 | ["w3r", "eso", "urc", "e"] 45 | ``` 46 | 47 | ### Question 7 48 | 49 | Write a JavaScript function to find a word within a string. 50 | Test Data : 51 | 52 | ``` 53 | console.log(search_word('The quick brown fox', 'fox')); 54 | console.log(search_word('aa, bb, cc, dd, aa', 'aa')); 55 | Output : 56 | "'fox' was found 1 times." 57 | "'aa' was found 2 times." 58 | ``` 59 | 60 | ### Question 8 61 | 62 | Create an array of numbers. Now filter out all the numbers from the array where number is in between 30-50. After filtering the numbers, add 20 to each number and finally print the sum of all numbers using reduce function. 63 | 64 | ### Question 9 65 | 66 | Convert below array: 67 | 68 | ``` 69 | [[1,2], [3,4], [5,6], [7,8], [9,10]] 70 | to 71 | [3,7,11,15,19] 72 | ``` 73 | 74 | ### Question 10 75 | 76 | Print below pattern: 77 | 78 | ``` 79 | 1 2 3 4 5 80 | 2 3 4 5 81 | 3 4 5 82 | 4 5 83 | 5 84 | ``` 85 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/18-map-exercise.md: -------------------------------------------------------------------------------- 1 | ## Map Questions 2 | 3 | 1. Create a new Map and add key-value pairs to it. 4 | 2. Get the value of a specific key in a Map. 5 | 3. Check if a key exists in a Map. 6 | 4. Iterate over the keys of a Map using a for...of loop. 7 | 5. Iterate over the values of a Map using a for...of loop. 8 | 6. Iterate over the key-value pairs of a Map using a for...of loop. 9 | 7. Convert a Map to an array of key-value pairs. 10 | 8. Convert an array of key-value pairs to a Map. 11 | 9. Use the forEach() method to iterate over the key-value pairs of a Map. 12 | 10. Use the Map keys() method to get an iterator for the keys of a Map. 13 | 11. Use the Map values() method to get an iterator for the values of a Map. 14 | 12. Use the Map entries() method to get an iterator for the key-value pairs of a Map. 15 | 13. Use the Map has() method to check if a Map contains a key. 16 | 14. Use the Map get() method to get the value associated with a key in a Map. 17 | 15. Use the Map set() method to add a new key-value pair to a Map. 18 | 16. Use the Map delete() method to remove a key-value pair from a Map. 19 | 17. Use the Map clear() method to remove all key-value pairs from a Map. 20 | 18. Use the Object.fromEntries() method to create a new object from a Map. 21 | 19. Use the Map constructor to create a new Map from an array of key-value pairs. 22 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/19-call-apply-bind-exercise.md: -------------------------------------------------------------------------------- 1 | ## Call/Apply/Bind Questions 2 | 3 | ### Question 1 4 | 5 | Write a function that uses the call method to print the name of an object. 6 | 7 | ### Question 2 8 | 9 | Write a function that uses the apply method to find the minimum value in an array of numbers. 10 | 11 | ### Question 3 12 | 13 | Write a function that uses the bind method to create a new function that always has a specific "this" value. 14 | 15 | ### Question 4 16 | 17 | Write a function that uses the call method to add two numbers together. 18 | 19 | ### Question 5 20 | 21 | Write a function that uses the apply method to concatenate two arrays. 22 | 23 | ### Question 6 24 | 25 | Write a function that uses the bind method to create a new function that multiplies a number by a specified value. 26 | 27 | ### Question 7 28 | 29 | Write a function that uses the call method to find the length of a string. 30 | 31 | ### Question 8 32 | 33 | Write a function that uses the apply method to find the sum of all numbers in an array. 34 | 35 | ### Question 9 36 | 37 | Write a function that uses the bind method to create a new function that logs a message with a specific prefix. 38 | 39 | ### Question 10 40 | 41 | Write a function that uses the call method to convert a string to uppercase. 42 | 43 | ### Question 11 44 | 45 | Create a function sum that takes in two numbers and returns their sum. Use call to invoke sum with an array [2, 3] as the context and log the result to the console. 46 | 47 | ### Question 12 48 | 49 | Create an object person with a property name set to your name. Create a function sayHello that logs "Hello, !". Use bind to create a new function sayHi that logs "Hi, !" and use it to greet yourself. 50 | 51 | ### Question 13 52 | 53 | Write a function greet that takes in a string name and logs "Hello, !". Use apply to pass in an array ["Alice"] as the context and invoke the function. 54 | 55 | ### Question 14 56 | 57 | Create a function multiply that takes in two numbers and returns their product. Use bind to create a new function double that always doubles its argument, and use it to multiply 5 by 2. 58 | 59 | ### Question 15 60 | 61 | Create a function square that takes in a number and returns its square. Use map and square to create a new array squares that contains the squares of the numbers in an array [1, 2, 3, 4, 5]. 62 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/20-string-array-exercise.md: -------------------------------------------------------------------------------- 1 | 1. Write a function that takes a string and returns a new string with all the words reversed using the spread operator. 2 | 3 | 2. Create a function that takes in an array and uses the rest operator to remove the first element from the array and finally return the array without first element. 4 | 5 | 3. Create a function that takes in an unknown number of arrays and uses the rest operator to flatten them into a single array 6 | 7 | 4. Write a function that takes an object as a parameter and returns the value of its "x" property if it exists, otherwise it returns null. Hint : (Use optional chaining) 8 | 9 | 5. Write a function which takes in an array and create two separate arrays for odd numbers and even numbers and finally merge them in the order that all odd numbers will move to the left of the array and all even numbers to right of the array. 10 | 11 | 6. Create an array of numbers. Now change the position of each element with their next element. 12 | ``` 13 | For example : [1,2,3,4,5,6,7] 14 | Output : [2,1,4,3,6,5,7] 15 | ``` 16 | 17 | 7. Ask user below questions 18 | ``` 19 | What is your age : 12 20 | What is your mobile : 9581894461 21 | What is your address : Jaipur 22 | ``` 23 | 24 | Now create an object and use enhanced object literal property computation to create below object 25 | ``` 26 | { 27 | age12 : 12 28 | 9581894461 : 'Mobile', 29 | Jaipur12Address : 'Jaipur' 30 | } 31 | ``` 32 | 33 | 8. Using enhanced object literal function, create a function sum which takes an array as parameter and return sum of all the numbers in the array. 34 | 35 | 9. Take a number and check if number is greater than 80 or not. If yes then assign 100 to number else assign 200. Use short circuiting whereever possible. 36 | 37 | 10. Create an array of 10 numbers. Now create a new array of 0 and 1 using Array destructring based on if number is odd then 1 else 0 38 | ``` 39 | Array : [1,2,3,4,5,6,7,8,9] 40 | Output: [1,0,1,0,1,0,1,0,1,0] 41 | ``` 42 | 43 | 11. Given an array of price, use map function to return a new array where each price is converted to new price including tax, which is the price with a 10% tax added. 44 | 45 | 12. Given an array of strings, use reduce to return the total number of characters in all the strings. 46 | 47 | 13. Given an array of strings, use map and reduce to return the total number of characters in all the strings with a length less than 5. 48 | 49 | 14. Given an array of numbers, use map, filter, and reduce to return the sum of all the odd numbers multiplied by 3 50 | 51 | 15. Given a string, reverse the order of the words in the string. For example, "the quick brown fox" becomes "fox brown quick the". 52 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/21-date-number-exercise.md: -------------------------------------------------------------------------------- 1 | ## Date & Number exercise 2 | 3 | Question 1 : How can you convert a string to a number in JavaScript? write all the ways. 4 | 5 | Question 2 : How do you round a number to a certain number of decimal places in JavaScript? 6 | 7 | Question 3 : How can you generate a random number between two values in JavaScript? 8 | 9 | Question 4 : How do you convert a number to a binary, octal, or hexadecimal format in JavaScript? 10 | 11 | Question 5 : How do you add or subtract a certain number of days from a date in JavaScript? 12 | 13 | Question 6 : How do you compare two dates in JavaScript? Check if a date is small or large or equal to other date? 14 | 15 | Question 7 : How can you format a date in JavaScript according to the user's locale? 16 | 17 | Question 8 : How do you calculate the difference between two dates in JavaScript? 18 | 19 | Question 9 : How do you check if a year is a leap year in JavaScript? 20 | 21 | Question 10 : How do you convert a string to a date in JavaScript? Write all ways? 22 | 23 | Question 11 : How can you parse a date from a string in a specific format in JavaScript? 24 | 25 | Question 12 : How can you get the time in a specific timezone in JavaScript? 26 | 27 | Question 13 : Print date and time after every 1 second in the format 'MM/DD/YYYY HH:MM:SS' 28 | 29 | Question 14 : Write a JavaScript function to get the number of days in a month. Pass month and year as an arugment to the function. for example : getDays(2, 2023). 30 | 31 | Question 15 : Write a JavaScript function to get the week day name for the given date. 32 | 33 | Question 16 : Write a JavaScript function to get the month name from the given date 34 | 35 | Question 17 : Write a JavaScript function to check if given date is on weekend or not (Saturday/Sunday). 36 | 37 | Question 18 : Ask your about his date of birth. Now write a JavaScript function to calculate age based on the given date of birth. 38 | 39 | Question 19 : Write a Javascript function to using setInterval to show alert box when date is your birth date. 40 | 41 | Question 20 : Show your birth date in Arabic. 42 | 43 | Question 21 : Show your birth date in Chinese. 44 | 45 | Question 22 : Write a JavaScript function to convert a binary number to a decimal number. 46 | 47 | Question 23 : Write a JavaScript function to convert a decimal number to binary, hexadecimal or octal number. 48 | 49 | Question 24 : Write a JavaScript function to find the highest value in an array using Math.max 50 | 51 | Question 25 : Write a JavaScript function to find the highest value in an array using Math.min 52 | 53 | Question 26 : Write a JavaScript function to check whether a value is an integer or not. 54 | 55 | Question 27 : Write a JavaScript function to convert a positive number to negative number or to negativie number to positive number. 56 | 57 | Question 28 : Convert 50 litre to Hindi locale and chinese locale. 58 | 59 | Question 29 : Create a function to convert any number to given currency. 60 | 61 | Question 30 : Write a JavaScript program to find the missing number from a given array. There are no duplicates in the list. Start from 1. 62 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/22-basic-test-exercise.md: -------------------------------------------------------------------------------- 1 | ### Basic Test 2 | 3 | 1. Using prompt ask user below questions and then print these values in console 4 | - What is your name 5 | - What is your batch name 6 | - What is your birth year 7 | 8 | Now print name, batch name and age in the console. Let's say if birth year of the user is 1991 then output should be his/her current age 31 years 9 | 10 | 2. Print numbers like 3, 6, 9, 12, 15 until the number is less than 100. 11 | 3. Write the differences between truthy and falsy values. 12 | 4. Write the differences between implicit and explicit type conversion. 13 | 5. Ask user a question "Do you want to study Nodejs"? If user click on "OK" button then print "Yes" else print "No" in the console 14 | 6. Take one number. If number is odd and less than 20 then in alert box show "Yes" and else show "No" in alert box. 15 | 7. If rating is 5 then print Excellent. If rating is 4 then print Good. If rating is 3 then print Average. If rating is 2 then print Poor. If rating is 1 then print Very Poor else print Invalid rating 16 | 8. What is the significance of use strict ? 17 | 9. Convert any if else condition to ternary operator. 18 | 10. Check if a number is divisible by 13 or not. If yes then check number is also divisible by 4 or not. If both conditions matches then print "Yes" else print "No". 19 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/exercises/23-basic-test-exercise.md: -------------------------------------------------------------------------------- 1 | 1. Print below pattern: 2 | 3 | ``` 4 | 1 5 | 23 6 | 456 7 | 78910 8 | 1112131415 9 | ``` 10 | 11 | 2. Create a JavaScript program that prompts the user to enter their age. If the age entered is less than 18, display an alert box with the message "Sorry, you must be at least 18 years old to access this website." If the age entered is between 18 and 30, display a confirm box with the message "Are you sure you want to proceed?" If the user clicks "Cancel" in the confirm box, display an alert box with the message "Action canceled." If the user clicks "OK" in the confirm box, display a prompt box asking for their name and display an alert box with the message "Welcome, [Name]!" (replace [Name] with the name entered). 12 | 13 | 3. Create a JavaScript program that calculates the average of three numbers. Prompt the user to enter three numbers and display the average using an alert box. 14 | 15 | 4. Solve below expressions 16 | - 5 + 2 * 3 - 4 / 2 17 | - 10 % 3 + 4 * 2 / 5 18 | - 15 % (7 + 3) - 4 * 2 19 | - (2 + 3) * (4 - 1) + 6 / 2 20 | - 12 / 3 + 4 - 2 * 5 21 | 22 | 5. Explain the difference between the == and === operators in JavaScript, and provide an example where their behavior differs. 23 | 24 | 6. Explain the difference between the slice and substring operators in JavaScript, and provide an example where their behavior differs. 25 | 26 | 7. Write a JavaScript program that prompts the user to enter their age and their country of residence. Based on the age and country, display a message using if-else if-else statements and logical operators. Consider the following conditions: 27 | 28 | ``` 29 | If the age is less than 18, display "Sorry, you must be at least 18 years old." 30 | If the age is 18 or older and the country is "USA", display "Welcome! Enjoy your stay in the USA." 31 | If the age is 18 or older and the country is "UK", display "Welcome! Enjoy your stay in the UK." 32 | If the age is 18 or older and the country is neither "USA" nor "UK", display "Welcome! Enjoy your stay." 33 | ``` 34 | 35 | 8. Question: Write a JavaScript program that prompts the user to enter a sentence. The program should perform the following operations: 36 | 37 | ``` 38 | Use the toLowerCase function to convert the sentence to lowercase. 39 | Use the replace function to replace all spaces with dashes ("-") in the modified sentence. 40 | Use the slice function to extract a substring from the 2nd to the 6th character (inclusive) of the modified and replaced sentence. 41 | Use the startsWith function to check if the extracted substring starts with the letter "a". 42 | Display the result of the check using an alert box. 43 | ``` 44 | 45 | 9. Question: Write a JavaScript function called calculateArea that takes the length and width of a rectangle as parameters and returns the area of the rectangle. The formula for calculating the area is length * width. 46 | 47 | 10. Write a JavaScript function which calculate sum of 4 numbers. If sum of 4 numbers is greater than 100 then return 1 else return 2. 48 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/solutions/06-basic-knowledge-solution.md: -------------------------------------------------------------------------------- 1 | To solve the given Github assignment, follow these steps: 2 | 3 | ## Step 1: 4 | 5 | Login to Github and create a new repository by clicking on the "+" icon on the top-right corner of the screen, then selecting "New repository". 6 | 7 | ## Step 2: 8 | 9 | Give your repository a name "learnjavascript" and tick the ".readme" checkbox to create a README.md file. 10 | 11 | ## Step 3: 12 | 13 | In the "Description" field, write "Training Repository". 14 | 15 | ## Step 4: 16 | 17 | Clone this repository to your local machine by using the command "git clone " in your terminal. 18 | 19 | ## Step 5: 20 | 21 | Navigate to the repository folder on your local machine using your terminal by using the command "cd ". 22 | 23 | ## Step 6: 24 | 25 | Add three new files to your repository: index.html, style.css, script.js using the command "touch ". 26 | 27 | ## Step 7: 28 | 29 | Add five commits as follows: 30 | 31 | - In the first commit, add index.html using the command "git add index.html" and then commit the changes using the command "git commit -m 'added index.html file'". 32 | - In the second commit, add style.css file using the command "git add style.css" and then commit the changes using the command "git commit -m 'added style.css file'". 33 | - In the third commit, add script.js file using the command "git add script.js" and then commit the changes using the command "git commit -m 'added script.js file'". 34 | - In the fourth commit, modify script.js file using the command "git add script.js" and then commit the changes using the command "git commit -m 'modified script.js file'". 35 | - In the fifth commit, delete style.css file using the command "git rm style.css" and then commit the changes using the command "git commit -m 'deleted style.css file'". 36 | 37 | ## Step 8: 38 | 39 | Create a new branch using the command "git branch ". 40 | 41 | ## Step 9: 42 | 43 | Switch to the new branch using the command "git checkout " and then add three commits as follows: 44 | 45 | - In the first commit, add style.css file using the command "git add style.css" and then commit the changes using the command "git commit -m 'added style.css file'". 46 | - In the second commit, add other.html file using the command "touch other.html" and then commit the changes using the command "git commit -m 'added other.html file'". 47 | - In the third commit, modify index.html file using the command "git add index.html" and then commit the changes using the command "git commit -m 'modified index.html file'". 48 | 49 | ## Step 10: 50 | 51 | Switch back to the main branch using the command "git checkout main" and then verify the changes made in the new branch using the command "git log " or "git diff ". 52 | -------------------------------------------------------------------------------- /Exercises-And-Solutions/solutions/08-github-solution.md: -------------------------------------------------------------------------------- 1 | # To solve this Github assignment, follow these steps: 2 | 3 | ### Step 1: 4 | 5 | Login to Github and create a new repository by clicking on the "+" icon on the top-right corner of the screen, then selecting "New repository". 6 | 7 | ### Step 2: 8 | 9 | Give your repository a name "learnjavascript" and tick the ".readme" checkbox to create a README.md file. 10 | 11 | ### Step 3: 12 | 13 | In the "Description" field, write "Training Repository". 14 | 15 | ### Step 4: 16 | 17 | Clone this repository to your local machine by using the command "git clone " in your terminal. 18 | 19 | ### Step 5: 20 | 21 | Navigate to the repository folder on your local machine using your terminal by using the command "cd ". 22 | 23 | ### Step 6: 24 | 25 | Add three new files to your repository: index.html, style.css, script.js using the command "touch ". 26 | 27 | ### Step 7: 28 | 29 | - Add five commits as follows: 30 | 31 | In the first commit, add index.html using the command "git add index.html" and then commit the changes using the command "git commit -m 'added index.html file'". 32 | 33 | In the second commit, add style.css file using the command "git add style.css" and then commit the changes using the command "git commit -m 'added style.css file'". 34 | 35 | In the third commit, add script.js file using the command "git add script.js" and then commit the changes using the command "git commit -m 'added script.js file'". 36 | 37 | In the fourth commit, modify script.js file using the command "git add script.js" and then commit the changes using the command "git commit -m 'modified script.js file'". 38 | 39 | In the fifth commit, delete style.css file using the command "git rm style.css" and then commit the changes using the command "git commit -m 'deleted style.css file'". 40 | 41 | ### Step 8: 42 | 43 | Create a new branch using the command "git branch ". 44 | 45 | ### Step 9: 46 | 47 | Switch to the new branch using the command "git checkout " and then add three commits as follows: 48 | 49 | In the first commit, add style.css file using the command "git add style.css" and then commit the changes using the command "git commit -m 'added style.css file'". 50 | 51 | In the second commit, add other.html file using the command "touch other.html" and then commit the changes using the command "git commit -m 'added other.html file'". 52 | 53 | In the third commit, modify index.html file using the command "git add index.html" and then commit the changes using the command "git commit -m 'modified index.html file'". 54 | 55 | ### Step 10: 56 | 57 | Switch back to the main branch using the command "git checkout main" and then verify the changes made in the new branch using the command "git log " or "git diff " 58 | -------------------------------------------------------------------------------- /Git Notes/Git-Cheatsheet by Atlassian.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sajidhamdard/learnjavascript/374614bdcd72b5e6eb4319964b501bc1ecee419e/Git Notes/Git-Cheatsheet by Atlassian.pdf -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Sajid Ali Khan 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 | -------------------------------------------------------------------------------- /Roadmap/Backend development roadmap.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sajidhamdard/learnjavascript/374614bdcd72b5e6eb4319964b501bc1ecee419e/Roadmap/Backend development roadmap.pdf -------------------------------------------------------------------------------- /Roadmap/Frontend development roadmap.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sajidhamdard/learnjavascript/374614bdcd72b5e6eb4319964b501bc1ecee419e/Roadmap/Frontend development roadmap.pdf -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use any latest version of JavaScript 6 | 7 | ## Reporting a Vulnerability 8 | 9 | please mail to sajid.hmdrd@gmail.com 10 | -------------------------------------------------------------------------------- /notes/English/03-separation-of-concerns.md: -------------------------------------------------------------------------------- 1 | # Separation of Concerns 2 | 3 | ### What is separation of concerns principle ? 4 | 5 | The separation of concerns principle in JavaScript refers to the practice of separating different parts of a program or application into distinct and independent units, with each unit responsible for a specific functionality or concern. This allows for better organization, maintainability, and scalability of the codebase. For example, in a Web application, the concerns of layout, styling, and scripting can be separated into different modules or files. This allows for easier testing, debugging, and updating of individual parts of the application without affecting the rest of the codebase 6 | 7 | ### How to link JavaScript file in html ? 8 | 9 | You can link a JavaScript file in an HTML file using the 16 | ``` 17 | 18 | You can also include the JavaScript code directly within the 24 | ``` 25 | 26 | It's important to note that the 35 | 36 | 37 |

Welcome to my website

38 | 39 | 40 | ``` 41 | 42 | Is example mein, humne