├── 1_BASIC_JS
├── index.js
├── program28.js
├── Task1.txt
├── index.html
├── Task6.txt
├── program9.js
├── program38.js
├── program14.js
├── program15.js
├── program8.js
├── program19.js
├── program16.js
├── program17.js
├── Task7.txt
├── program1.js
├── Task5.txt
├── program12.js
├── program29.js
├── Task4.txt
├── program4.js
├── FOR_FOREACH.js
├── program37.js
├── Task2.txt
├── program6.js
├── program18.js
├── program27.js
├── program10.js
├── program7.js
├── program21.js
├── program26.js
├── program22.js
├── program13.js
├── program11.js
├── program20.js
├── Task3.txt
├── program3.js
├── program2.js
├── program25.js
├── program23.js
└── program5.js
├── 3_JS HTML DOM
├── 5_DOM_EVENTS
│ ├── onsubmit
│ │ ├── style.css
│ │ ├── index.js
│ │ └── index.html
│ ├── mouse-events
│ │ ├── style.css
│ │ ├── index.html
│ │ └── index.js
│ ├── focus-events
│ │ ├── index.html
│ │ └── index.js
│ ├── clipboard-events
│ │ ├── index.html
│ │ └── index.js
│ ├── keyboard-events
│ │ ├── index.html
│ │ └── index.js
│ ├── index.html
│ ├── index.js
│ ├── media-events
│ │ ├── index.html
│ │ └── index.js
│ ├── more-event-object
│ │ ├── index.html
│ │ └── index.js
│ └── onchange
│ │ ├── index.html
│ │ └── onchange.js
├── 4_CSS_STYLING
│ ├── style.css
│ ├── index.js
│ └── index.html
├── 6_DOM_EVENT_LISTENER
│ ├── index.html
│ └── index.js
├── 1_FIND_HTML_ELEMENTS
│ ├── index.html
│ └── program27.js
├── 3_CREATE_ADD_REMOVE_HTML_ELEMENTS
│ ├── index.html
│ └── index.js
├── 2_CHANGE_HTML_ELEMENTS
│ ├── index.html
│ └── program28.js
└── 7_DOM_SUMMARY
│ └── index.js
├── 4_Browser_BOM
├── style.css
├── index.html
├── index1.js
├── index.js
└── index2.js
├── 6_ES6 FEATURES
├── 6_ES6_MODULES
│ ├── myModule.js
│ ├── index.js
│ └── index.html
├── 7_ES6_CLASS
│ └── index.js
├── 8_ASYNCHRONOUS_PROG
│ ├── index.html
│ ├── index5.js
│ ├── index4.js
│ ├── index2.js
│ ├── index1.js
│ └── index3.js
├── 1_ES6_SYNTAX
│ ├── 1.4_DEFAULT_AND_REST_PARAMETER.js
│ ├── 1.3_TEMPLATE_LITERAL.js
│ ├── 1.1_ES6_VARIABLES.js
│ ├── 1.7_FOROF_FORIN.js
│ ├── 1.2_HOISTING_STRICTMODE.js
│ ├── 1.6_OBJECT_LITERAL.js
│ └── 1.5_SPREAD_OPERATOR.js
├── 5_STRING_METHODS
│ └── index.js
├── 4_ARRAY_METHODS
│ └── index.js
├── 3_DESTRUCTURING
│ └── index.js
└── 2_ARROW_FUNCTION
│ └── ARROW_FUNCTION.js
├── 9_Storage
├── cookie-example.js
├── index.html
├── session-storage.js
└── local-storage.js
├── 11_PROJECT
└── image-slider-project
│ ├── images
│ ├── flower-1.jpg
│ ├── flower-2.jpg
│ └── flower-3.jpg
│ ├── scripts
│ └── index.js
│ ├── styles
│ └── style.css
│ └── index.html
├── 8_JSON
├── friends.json
└── index.js
├── 2_DATA_STRUCTURE
├── index.html
├── index4.js
├── index3.js
├── index5.js
├── index1.js
└── index2.js
├── 5_Error_Handling
├── ERROR_HANDLING_1.js
└── ERROR_HANDLING_2.js
├── 7_API_CALLING
├── scripts
│ ├── jquery.js
│ ├── xhr.js
│ ├── axios.js
│ └── fetch.js
└── index.html
└── README.md
/1_BASIC_JS/index.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/3_JS HTML DOM/5_DOM_EVENTS/onsubmit/style.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/4_Browser_BOM/style.css:
--------------------------------------------------------------------------------
1 | .para {
2 | color: red;
3 | }
--------------------------------------------------------------------------------
/6_ES6 FEATURES/6_ES6_MODULES/myModule.js:
--------------------------------------------------------------------------------
1 | export let text = "Welcome to module";
2 |
3 |
4 |
--------------------------------------------------------------------------------
/6_ES6 FEATURES/6_ES6_MODULES/index.js:
--------------------------------------------------------------------------------
1 | import {text as message} from './myModule.js'
2 |
3 | console.log(message)
4 |
--------------------------------------------------------------------------------
/9_Storage/cookie-example.js:
--------------------------------------------------------------------------------
1 | document.cookie = "username=anisul; expires= Mon, 23 Feb 2022 20:27:00 GMT";
2 |
3 | console.log(document.cookie);
4 |
--------------------------------------------------------------------------------
/3_JS HTML DOM/4_CSS_STYLING/style.css:
--------------------------------------------------------------------------------
1 | .heading-style{
2 | color: green;
3 | font-size: 3rem;
4 | font-weight: bold;
5 | font-style: italic;
6 | }
--------------------------------------------------------------------------------
/3_JS HTML DOM/5_DOM_EVENTS/mouse-events/style.css:
--------------------------------------------------------------------------------
1 | div {
2 | background-color: tomato;
3 | height: 20rem;
4 | width: 20rem;
5 | padding: 2rem;
6 | }
7 |
--------------------------------------------------------------------------------
/11_PROJECT/image-slider-project/images/flower-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anisul-Islam/javascript-tutorials-code/HEAD/11_PROJECT/image-slider-project/images/flower-1.jpg
--------------------------------------------------------------------------------
/11_PROJECT/image-slider-project/images/flower-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anisul-Islam/javascript-tutorials-code/HEAD/11_PROJECT/image-slider-project/images/flower-2.jpg
--------------------------------------------------------------------------------
/11_PROJECT/image-slider-project/images/flower-3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anisul-Islam/javascript-tutorials-code/HEAD/11_PROJECT/image-slider-project/images/flower-3.jpg
--------------------------------------------------------------------------------
/1_BASIC_JS/program28.js:
--------------------------------------------------------------------------------
1 | var number = Number(prompt("Enter a number "));
2 | var result = number>0 ? "positive" : number<0 ? "Negative" : "zero";
3 | console.log(result)
4 |
5 |
--------------------------------------------------------------------------------
/8_JSON/friends.json:
--------------------------------------------------------------------------------
1 | {
2 | "friends": [{
3 | "name": "Anar",
4 | "age": 25
5 | },
6 | {
7 | "name": "Ruhul",
8 | "age": 28
9 | }
10 | ]
11 | }
--------------------------------------------------------------------------------
/1_BASIC_JS/Task1.txt:
--------------------------------------------------------------------------------
1 | /* Program for Task 1*/
2 | // A program to print your details info
3 | document.write("Name : Anisul Islam
")
4 | document.write("Nationality : Bangladeshi
")
5 | document.write("Email : anisul2010s@yahoo.co.uk")
--------------------------------------------------------------------------------
/3_JS HTML DOM/4_CSS_STYLING/index.js:
--------------------------------------------------------------------------------
1 | // Adding & removing css style in js
2 |
3 | var h1 = document.querySelector("h1");
4 | h1.innerHTML = "hiiii"
5 | console.log(h1)
6 |
7 | //add css style
8 | h1.classList.add('heading-style')
9 |
10 | //removing css style
11 | // h1.classList.remove('heading-style')
--------------------------------------------------------------------------------
/1_BASIC_JS/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/2_DATA_STRUCTURE/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/1_BASIC_JS/Task6.txt:
--------------------------------------------------------------------------------
1 | /* Program for Task 6*/
2 | // A program that will find sum of all numbers from 1 to 100 that are divisible by 3 and 5
3 |
4 | var sum = 0
5 | var i = 1
6 | while (i <= 100) {
7 | if (i % 3 == 0 && i % 5 == 0) {
8 | sum = sum + i
9 | }
10 | i = i + 1
11 | }
12 | document.write("sum is : " + sum)
13 |
--------------------------------------------------------------------------------
/6_ES6 FEATURES/6_ES6_MODULES/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Document
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program9.js:
--------------------------------------------------------------------------------
1 | //Temperature converter program
2 |
3 | var farn = parseFloat(prompt("Enter Fahrenheit = "));
4 | var cels = (farn - 32) * (5 / 9);
5 | document.write("Celsius = " + cels + "
");
6 |
7 | // var cels = parseFloat(prompt("Enter Celsius = "));
8 | // var farn = (cels * (9 / 5)) + 32;
9 | // document.write("Fahrenheit = " + farn);
10 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program38.js:
--------------------------------------------------------------------------------
1 | // map, filter
2 |
3 | var numbers = [22, 31, 4, 5, 35, 26, 78];
4 | var squareNumbers = numbers.map(function (x) {
5 | return x * x;
6 | });
7 | console.log(squareNumbers);
8 |
9 | var numbers = [22, 31, 4, 5, 35, 26, 78];
10 | var newNumbers = numbers.filter(function (x) {
11 | return x > 10;
12 | });
13 | console.log(newNumbers);
14 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program14.js:
--------------------------------------------------------------------------------
1 | //A program to demonstrate for loop
2 |
3 | // for loop syntax
4 | for (var i = 1; i <= 10; i++) {
5 | document.write("Bangladesh" + "
");
6 | }
7 |
8 | document.write("End of for loop");
9 |
10 | // sum of numbers 1+2+..+100
11 | var sum = 0;
12 | for (var x = 1; x <= 100; x++) {
13 | sum = sum + x;
14 | }
15 | document.write("The sum is " + sum);
16 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program15.js:
--------------------------------------------------------------------------------
1 | //A program to demonstrate while loop
2 | // while loop syntax
3 | var i = 1;
4 | while (i <= 10) {
5 | document.write("Bangladesh" + "
");
6 | i++;
7 | }
8 |
9 | document.write("End of for loop");
10 |
11 | // sum of numbers 1+2+..+100
12 | var sum = 0;
13 | var x = 1;
14 | while (x <= 100) {
15 | sum = sum + x;
16 | x++;
17 | }
18 | document.write(sum);
19 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program8.js:
--------------------------------------------------------------------------------
1 | // Area of various shapes
2 | //Area of triangel
3 |
4 | //getting user input for base
5 | var base = parseFloat(prompt("Enter Base = "));
6 |
7 | //getting user input for height
8 | var height = parseFloat(prompt("Enter Height = "));
9 |
10 | //calculating area
11 | var area = 0.5 * base * height;
12 |
13 | //printing area
14 | document.write("Area of triangle = " + area);
15 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program19.js:
--------------------------------------------------------------------------------
1 | // IIFEs (Immediately Invokeable Function Expressions)
2 |
3 | // (function display(message) {
4 | // console.log(message);
5 | // })('hi');
6 |
7 | // Function Expressions
8 | var display2 = function displayMessage(msg) {
9 | console.log(msg);
10 | };
11 | display2("I am message");
12 |
13 | // ( ), { }, [ ], < >
14 | // Task 7: create an IIFEs that print sum of 2 numbers
15 |
--------------------------------------------------------------------------------
/6_ES6 FEATURES/7_ES6_CLASS/index.js:
--------------------------------------------------------------------------------
1 | // es6 class, object, set, get
2 | class Student {
3 | constructor(id, name) {
4 | this.id = id;
5 | this.name = name;
6 | }
7 |
8 | set studentName(name) {
9 | this.name = name;
10 | }
11 | get studentInfo() {
12 | return this.id + " " + this.name;
13 | }
14 | }
15 |
16 | let s1 = new Student(101, "Anis");
17 | console.log(s1.studentInfo);
18 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program16.js:
--------------------------------------------------------------------------------
1 | // A program to demonstrate do while loop
2 | // do while loop syntax
3 | var i = 1;
4 | do {
5 | document.write("Bangladesh" + "
");
6 | i++;
7 | } while (i <= 10);
8 |
9 | document.write("End of do while loop");
10 |
11 | // sum of numbers 1+2+..+100
12 | var sum = 0;
13 | var x = 1;
14 | do {
15 | sum = sum + x;
16 | x++;
17 | } while (x <= 100);
18 | document.write(sum);
19 |
--------------------------------------------------------------------------------
/6_ES6 FEATURES/8_ASYNCHRONOUS_PROG/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | asynchronous
7 |
8 |
9 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/6_ES6 FEATURES/1_ES6_SYNTAX/1.4_DEFAULT_AND_REST_PARAMETER.js:
--------------------------------------------------------------------------------
1 | "use strict"
2 |
3 | //example of default parameter
4 | function message(text='Hello Everyone') {
5 | console.log(text);
6 | }
7 | message();
8 | message("love js es6");
9 |
10 |
11 |
12 | //example of rest parameter
13 | function printNumbers(x,y, ...z){
14 | console.log(`x = ${x}, y = ${y}, z= ${z}`)
15 | }
16 | printNumbers(10,20,30,40,50);
17 |
18 |
--------------------------------------------------------------------------------
/6_ES6 FEATURES/1_ES6_SYNTAX/1.3_TEMPLATE_LITERAL.js:
--------------------------------------------------------------------------------
1 | // In ES6, you can create a template literal by using your text inside backticks.
2 |
3 | var x = 20;
4 | var y = 10;
5 | var sum = x + y;
6 | console.log(`sum is ${x+y}`);
7 | console.log(`sum is ${sum}`);
8 |
9 | let uniName = `This is a template literal`
10 |
11 | let fullName = "Anisul Islam";
12 | let message = `I am ${fullName}. I am teaching ES6`;
13 | console.log(message);
--------------------------------------------------------------------------------
/6_ES6 FEATURES/8_ASYNCHRONOUS_PROG/index5.js:
--------------------------------------------------------------------------------
1 | const loadData = () => {
2 | fetch("https://jsonplaceholder.typicode.com/posts")
3 | .then((response) => response.json())
4 | .then((data) => {
5 | let lists = "";
6 | data.map((data, index) => {
7 | lists += `${data.title}`;
8 | });
9 | document.querySelector(".container ol").innerHTML = lists;
10 | });
11 | };
12 |
13 | loadData();
14 |
--------------------------------------------------------------------------------
/4_Browser_BOM/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/8_JSON/index.js:
--------------------------------------------------------------------------------
1 | const data = require("./friends.json");
2 | console.clear();
3 |
4 | // Accessing JSON Data
5 | // console.log(data);
6 | // console.log(data.friends[0]);
7 | // console.log(data.friends[0].name);
8 |
9 | // Modify JSON Data
10 | // data.friends[0].age = 35;
11 | // console.log(data.friends[0]);
12 |
13 | // delete JSON data
14 | // delete data.friends[0].age;
15 | // console.log(data.friends[0]);
16 |
17 | // conversion between js and json
18 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program17.js:
--------------------------------------------------------------------------------
1 | // break and continue program
2 |
3 | // The break statement "jumps out" of a loop or switch.
4 | for (var i = 1; i <= 100; i++) {
5 | if (i == 20) break;
6 | document.write(i + "
");
7 | }
8 |
9 | // The continue statement breaks one iteration (in the loop), if a specified condition occurs, and continues with the next iteration in the loop.
10 | for (var i = 1; i <= 100; i++) {
11 | if (i == 20) continue;
12 | document.write(i + "
");
13 | }
14 |
--------------------------------------------------------------------------------
/9_Storage/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/1_BASIC_JS/Task7.txt:
--------------------------------------------------------------------------------
1 | // creating a simple calculator that will add, sub, mul, div
2 | // Thanks for trying hard
3 | function add(num1, num2) {
4 | return num1 + num2;
5 | }
6 | function sub(num1, num2) {
7 | return num1 - num2;
8 | }
9 | function mul(num1, num2) {
10 | return num1 * num2;
11 | }
12 | function div(num1, num2) {
13 | return num1 / num2;
14 | }
15 |
16 | console.log(add(25, 20));
17 | console.log(sub(25, 20));
18 | console.log(mul(25, 20));
19 | console.log(div(25, 20));
20 |
--------------------------------------------------------------------------------
/3_JS HTML DOM/5_DOM_EVENTS/focus-events/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/5_Error_Handling/ERROR_HANDLING_1.js:
--------------------------------------------------------------------------------
1 | // Error handling -> try , catch, finally , throw
2 | // try ... catch handle run time errors (program which is runable), but not syntax error
3 | // Error object
4 | // The finally statement -> execute code, after try and catch
5 |
6 | try{
7 | // code test
8 | alert("Hi Everyone");
9 | alert(x);
10 | alert("Not gonna work");
11 |
12 | }catch(err){
13 | console.log(err);
14 | }finally{
15 | alert("Bye Everyone");
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program1.js:
--------------------------------------------------------------------------------
1 | // output functions -> functions that will help you to show output
2 | // document.write(), console.log(), alert()
3 | // console.clear(), console.error(), console.info(), console.warn()
4 |
5 | document.write("Welcome to JS Program");
6 | document.write("Welcome to JS Program
");
7 | document.write("Welcome to JS Program
");
8 |
9 | console.log("Welcome to JS Program");
10 |
11 | //this alert() will display an alert message
12 | alert("welcome to js program");
13 |
--------------------------------------------------------------------------------
/1_BASIC_JS/Task5.txt:
--------------------------------------------------------------------------------
1 | /* Program for Task 5*/
2 | // Vowel or connsonant program using switch
3 |
4 | var letter = prompt("Enter a letter : ")
5 | letter = letter.toLowerCase()
6 |
7 | // checking the conditions for vowel and consonant
8 | switch (letter) {
9 | case "a":
10 | case "e":
11 | case "i":
12 | case "o":
13 | case "u":
14 | document.write("Vowel");
15 | break;
16 | default:
17 | document.write("Consonant");
18 | }
19 | // Happy coding with Anisul Islam
--------------------------------------------------------------------------------
/3_JS HTML DOM/5_DOM_EVENTS/clipboard-events/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program12.js:
--------------------------------------------------------------------------------
1 | // A program that will find a letter is vowel or consonant
2 | var letter = prompt("Enter a letter : ");
3 |
4 | // convert any uppercase input into lower cause we set only lowercase letter in condition
5 | letter = letter.toLowerCase();
6 |
7 | // Now check the condition
8 | if (
9 | letter == "a" ||
10 | letter == "e" ||
11 | letter == "i" ||
12 | letter == "o" ||
13 | letter == "u"
14 | ) {
15 | console.log("Vowel");
16 | } else {
17 | console.log("Consonant");
18 | }
19 |
--------------------------------------------------------------------------------
/3_JS HTML DOM/5_DOM_EVENTS/clipboard-events/index.js:
--------------------------------------------------------------------------------
1 | // ClipboardEvent Object
2 | // oncopy
3 | // oncut
4 | // onpaste
5 |
6 | const input = document.querySelector("input");
7 | const p = document.querySelector("p");
8 |
9 | input.addEventListener("copy", function () {
10 | p.innerText = "you have copied";
11 | });
12 | input.addEventListener("cut", function () {
13 | p.innerText = "you have cut";
14 | });
15 | input.addEventListener("paste", function () {
16 | p.innerText = "you have pasted";
17 | });
18 |
--------------------------------------------------------------------------------
/3_JS HTML DOM/5_DOM_EVENTS/keyboard-events/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program29.js:
--------------------------------------------------------------------------------
1 | // date object
2 |
3 | var date = new Date();
4 | console.log(date);
5 |
6 | var year = date.getFullYear();
7 | console.log(year);
8 |
9 | var month = date.getMonth();
10 | console.log(month);
11 |
12 | var currentDate = date.getDate();
13 | console.log(currentDate);
14 |
15 | var currentDay = date.getDay();
16 | console.log(currentDay);
17 |
18 | var currentHour = date.getHours();
19 | console.log(currentHour);
20 |
21 | var currentMinutes = date.getMinutes();
22 | console.log(currentMinutes);
23 |
--------------------------------------------------------------------------------
/2_DATA_STRUCTURE/index4.js:
--------------------------------------------------------------------------------
1 | // One Dimensional Array
2 | // Create a function called highestScore that will
3 | // Receive a 1d array called scores
4 | // return the highest score
5 | console.clear();
6 | function highestScore(scores) {
7 | var max = scores[0];
8 | for (var x = 1; x < scores.length; x++) {
9 | if (max < scores[x]) {
10 | max = scores[x];
11 | }
12 | }
13 | return max;
14 | }
15 |
16 | var scores = [21, 98, 1, 88, 15];
17 | var maxScore = highestScore(scores);
18 | console.log(maxScore);
19 |
--------------------------------------------------------------------------------
/1_BASIC_JS/Task4.txt:
--------------------------------------------------------------------------------
1 | /* Program for Task 4*/
2 | // Letter Grade Program. Happy coding
3 |
4 | var marks = parseInt(prompt("Enter Marks : "))
5 |
6 | // checking the conditions
7 | if (marks >= 80)
8 | document.write("A+")
9 | else if (marks >= 70)
10 | document.write("A")
11 | else if (marks >= 60)
12 | document.write("A-")
13 | else if (marks >= 50)
14 | document.write("B")
15 | else if (marks >= 40)
16 | document.write("C")
17 | else if (marks >= 33)
18 | document.write("D")
19 | else
20 | document.write("Sorry. You are Failed")
--------------------------------------------------------------------------------
/5_Error_Handling/ERROR_HANDLING_2.js:
--------------------------------------------------------------------------------
1 | // Error handling - try, catch, finally
2 | // The throw statement -> create custom errors.
3 |
4 | document.querySelector("#checkButton").addEventListener("click",function(){
5 |
6 | var num = document.querySelector("#numTextfield").value;
7 |
8 | try{
9 | if(num < 5)
10 | {
11 | throw "input is too low"
12 | } else if(num > 10)
13 | {
14 | throw "input is too high"
15 | }
16 |
17 | }catch(err){
18 | console.log(err);
19 | }
20 |
21 | })
--------------------------------------------------------------------------------
/3_JS HTML DOM/5_DOM_EVENTS/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | DOM Events
7 |
8 |
9 |
10 | DOM EVENT
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_JS HTML DOM/6_DOM_EVENT_LISTENER/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | DOM EVENT LISTENER
7 |
8 |
9 |
10 | No button is clicked yet
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/9_Storage/session-storage.js:
--------------------------------------------------------------------------------
1 | // localStorage vs sessionStorage
2 | // 10mb vs 5mb
3 | // permanent vs session (tab)
4 |
5 | // sessionStorage.setItem("user1", "anis");
6 | // sessionStorage.setItem("user2", "linkon");
7 | // const userName = sessionStorage.getItem("user");
8 | // console.log(userName);
9 |
10 | // sessionStorage.removeItem("user");
11 |
12 | // sessionStorage.clear();
13 |
14 | const user = { id: "101", name: "anisul" };
15 | sessionStorage.setItem("user", JSON.stringify(user));
16 |
17 | const userInfo = JSON.parse(sessionStorage.getItem("user"));
18 | console.log(userInfo);
19 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program4.js:
--------------------------------------------------------------------------------
1 | //you can run this program by using the command => node program4 .js or adding this file in html
2 |
3 | // string -> a sequnces of characters
4 | // string concatenation -> adding multiple strings
5 |
6 | var fName = "Anisul";
7 | var lName = "Islam";
8 |
9 | // adding multiple strings here
10 | var fullName = fName + " " + lName;
11 | console.log(fullName);
12 | console.log("Today is" + " a " + "beautiful day");
13 | console.log("My name is " + fullName);
14 |
15 | var num1 = 20;
16 | var num2 = 30;
17 | var sum = num1 + num2;
18 | console.log(num1 + " + " + num2 + " = " + sum);
19 |
--------------------------------------------------------------------------------
/1_BASIC_JS/FOR_FOREACH.js:
--------------------------------------------------------------------------------
1 | var numbers = [10,20,30]
2 |
3 | //for loops
4 | for(let x=0; x {"key":"key_value"}
3 | // JSON Receives Boolean, Number, String, Array, Object
4 | // JSON.stringify() -> converts a JavaScript object or value to a JSON string
5 | // JSON.parse(JSONDATA) -> converts a JSON string to a JavaScript object or value
6 |
7 | const studentInfo = {
8 | id: 101,
9 | name: "Anisul Islam",
10 | gpa: 3.92,
11 | };
12 | const studentInfoJSON = JSON.stringify(studentInfo);
13 | console.log(studentInfoJSON);
14 |
15 | const studentInfoJSObject = JSON.parse(studentInfoJSON);
16 | console.log(studentInfoJSObject);
17 |
--------------------------------------------------------------------------------
/3_JS HTML DOM/5_DOM_EVENTS/media-events/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/1_BASIC_JS/program37.js:
--------------------------------------------------------------------------------
1 | // for vs foreach example
2 |
3 | // var numbers = [10,20,30,40];
4 | // for(var x=0; x
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
I am a div
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |