├── Class No. 1 (4-9-16) ├── JAVASCRIPT.docx ├── app.js ├── app1.js ├── index.html └── index1.html ├── Class No. 10 (6-11-2016) ├── app.js └── index.html ├── Class No. 11 (13-11-2016) ├── app.js ├── home.html ├── index.html └── js │ └── js.js ├── Class No. 12 (20-11-2016) ├── 1232.jpg ├── Delete.png ├── aa.jpg ├── app.js ├── index.html ├── todo.html └── todo.js ├── Class No. 13 (27-11-2016) ├── group.jpg ├── index.html └── index1.html ├── Class No. 16 (12-11-2016) ├── app.js └── index.html ├── Class No. 17 (1-1-2017) ├── app.js └── index.html ├── Class No. 18 (7-1-2017) ├── app.js └── index.html ├── Class No. 19 (22-1-2017) └── QuizApp Snapshot │ ├── app.js1.png │ ├── app.js2.png │ ├── app.js3.png │ └── index.png ├── Class No. 2 (11-9-16) ├── app.js └── index.html ├── Class No. 3 (18-9-16) ├── Assignment.html ├── Assignment.js └── New Text Document.txt ├── Class No. 4 (25-9-16) ├── app.js └── index.html ├── Class No. 5 (2-10-16) ├── app.js └── index.html ├── Class No. 6 (9-10-16) ├── app.js └── index.html ├── Class No. 7 (16-10-16) ├── app.js └── index.html ├── Class No. 8 (23-10-2016) ├── app.js └── index.html └── Class No. 9 (30-10-2016) ├── app.js └── index.html /Class No. 1 (4-9-16)/JAVASCRIPT.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mali521/Batch-4-JS/272b33ff0bb88a170fc018f5bdd53d7eafdbea3f/Class No. 1 (4-9-16)/JAVASCRIPT.docx -------------------------------------------------------------------------------- /Class No. 1 (4-9-16)/app.js: -------------------------------------------------------------------------------- 1 | var name , name1; 2 | name = "Muhammad Ali"; 3 | name1 = "Atique"; 4 | alert(name1); 5 | alert(name); -------------------------------------------------------------------------------- /Class No. 1 (4-9-16)/app1.js: -------------------------------------------------------------------------------- 1 | var a = 5; 2 | var b = "10"; 3 | var c = 6+7*4/2 ; 4 | var d = 10 % 3; 5 | alert(c); 6 | alert(d); 7 | console.log(100); -------------------------------------------------------------------------------- /Class No. 1 (4-9-16)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 1 (4-9-16)/index1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 10 (6-11-2016)/app.js: -------------------------------------------------------------------------------- 1 | // // Fibonacci Series (0,1,1,2,3,5,8,13....) 2 | // var input = +prompt("Enter limitation"); 3 | // var firstDigit = 0; 4 | // var secondDigit = 1; 5 | // var nextDigit; 6 | // document.write(firstDigit + " " + secondDigit); 7 | // for(var i = 2 ; i <= input ; i++){ 8 | // nextDigit = firstDigit + secondDigit; 9 | // document.write(" " + nextDigit + " "); 10 | // firstDigit = secondDigit; 11 | // secondDigit = nextDigit; 12 | // } 13 | 14 | 15 | // function table(){ 16 | // var a = +prompt("Enter Any Num"); 17 | // for ( var i= 1; i<=20; i++){ 18 | // document.write(a + " x " + i + " = " + a*i + "
"); 19 | // } 20 | // } 21 | // table(); 22 | 23 | 24 | // function diamond(){ 25 | // var noOfRows = prompt("Enter The Number Of number") 26 | // var row,colSpace,colStar 27 | // document.write('
')
 28 | // for(row=1;row<=noOfRows;row++){
 29 | // for(colSpace=noOfRows-row;colSpace>=1;colSpace--){
 30 | // document.write(' ')
 31 | // }
 32 | // for(colStar=1;colStar<=(row*2)-1;colStar++){
 33 | // document.write('*')
 34 | // }
 35 | // document.write("
") 36 | // } 37 | // for(row=noOfRows-1;row>=1;row--){ 38 | 39 | // for(colSpace=1;colSpace<=noOfRows-row;colSpace++){ 40 | // document.write(' ') 41 | // } 42 | 43 | // for(colStar=1;colStar<=2*row-1;colStar++){ 44 | // document.write("*") 45 | // } 46 | // document.write("
") 47 | // } 48 | 49 | // } 50 | 51 | // diamond(); 52 | 53 | // function add(a){ 54 | // // var add1= a; 55 | // return a*2; 56 | // } 57 | 58 | // var value = add(2); 59 | // alert(value); 60 | 61 | 62 | //var num; 63 | //num1(); 64 | //function num1(){ 65 | num = 5; 66 | //console.log(num); 67 | // var num = 15; 68 | // var num2 = 17; 69 | //console.log("Inside variable value is:" + num); 70 | //return num =5; 71 | //} 72 | //console.log("Outside variable value is:" +num); 73 | //console.log("Outside function value is:" +num2); 74 | //num1(); 75 | //console.log(num1()); 76 | 77 | //console.log(num); 78 | 79 | 80 | //General Syntax of Switch 81 | // switch(expression) { 82 | // case n: 83 | // code block 84 | // break; 85 | // case n: 86 | // code block 87 | // break; 88 | // default: 89 | // default code block 90 | // } 91 | 92 | switch (new Date().getDay()){ 93 | case 0: 94 | alert("Sunday"); 95 | break; 96 | case 1: 97 | alert("Mon"); 98 | break; 99 | case 2: 100 | alert("Tues"); 101 | break; 102 | case 3: 103 | alert("Wed"); 104 | break; 105 | case 4: 106 | alert("Thurs"); 107 | break; 108 | case 5: 109 | alert("Friday"); 110 | break; 111 | default: 112 | alert("Sat") 113 | } -------------------------------------------------------------------------------- /Class No. 10 (6-11-2016)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 11 (13-11-2016)/app.js: -------------------------------------------------------------------------------- 1 | // 1. I created a file script.js. I added it in HTML document and then I start adding code in 2 | // script.js like 3 | // 6 | // Am I doing something right? 7 | 8 | 9 | 10 | 11 | // 2. What will be the possible output 12 | // 2 % console.log(20 % 6); 13 | 14 | 15 | 16 | // 3. What will be the possible output 17 | // console.log(-prompt()); 18 | 19 | 20 | 21 | 22 | // 4. What could be the answer of this: 23 | // (true + false) > 2 + true 24 | 25 | 26 | 27 | 28 | 29 | // 5. What will be the answer of this code: 30 | // "1" - - "1"; 31 | 32 | 33 | 34 | 35 | // 6. Possible output ? 36 | // [] + [] + 'foo'.split(''); 37 | 38 | 39 | 40 | // 7. What will be the output ? 41 | // new Array(5).toString() 42 | 43 | 44 | 45 | 46 | // 8. Possible output of the following: 47 | // var myArr = ["foo","bar","baz"]; 48 | // myArr.length = 0; 49 | // myArr.push("bin"); 50 | // console.log(myArr); 51 | 52 | 53 | 54 | // 8(a) var arr = []; 55 | // alert(typeof arr); 56 | // alert(typeof arr[2]) 57 | 58 | 59 | 60 | // 9. What can be the output: 61 | // 10 > 9 > 8 === true; 62 | 63 | 64 | 65 | // 10. Possible output: 66 | // function makeAdder(amount) { 67 | // return function(number) { 68 | // return number + amount; 69 | // }; 70 | // } 71 | // var addTwo = makeAdder(2); 72 | // alert(addTwo(3)); 73 | 74 | 75 | 76 | 77 | 78 | // 11. Possible outputs: 79 | // function someName(a,b,c){ 80 | // return typeof arguments; 81 | // } 82 | // someName(1,2,3); 83 | 84 | 85 | 86 | 87 | // 12. If you have var y = 1, x = y . Find typeof x 88 | 89 | 90 | // 13. for var a = (1, 5 - 1) * 2 91 | 92 | 93 | // 14. What is -5%2 94 | 95 | 96 | 97 | 98 | // 15) num = 10++; 99 | // alert(7++); 100 | // alert(num) 101 | 102 | 103 | 104 | 105 | // 16) var num = 10; 106 | // num = num + num++; 107 | 108 | 109 | 110 | 111 | // 17) var num = 10; 112 | // num = num++ - num-- + num; 113 | 114 | 115 | 116 | 117 | 118 | // 18) var num = "10"; 119 | // num = num-- + num-- + num--; 120 | // alert(num) 121 | 122 | 123 | 124 | 125 | // 19) var result = prompt(NaN); 126 | // alert(typeof result); 127 | 128 | 129 | 130 | 131 | 132 | // 20) function func (){} 133 | // alert(typeof func); 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | // 21) function func (){} 143 | // alert(typeof func) 144 | // alert(typeof func()) 145 | 146 | // 22) function func(){ 147 | // alert("1"); 148 | // } 149 | // alert("2") 150 | // func(); 151 | 152 | // 23) function func(){ 153 | // var a = 10 154 | // } 155 | // alert(a) 156 | // func(); 157 | 158 | 159 | 160 | 161 | 162 | // 24) var a = "hello"; 163 | // function func(){ 164 | // var a = "world"; 165 | // alert(a) 166 | // } 167 | // alert(a); 168 | // func() 169 | // alert(a); 170 | 171 | 172 | // 25) function func(){ 173 | // var name = "hello"; 174 | // return name; 175 | // name = "world"; 176 | // } 177 | // alert(func()) 178 | 179 | 180 | 181 | // 26) function func(){ 182 | // var num = 10; 183 | // return num; 184 | // } 185 | // var a = func()++; 186 | // alert(a); 187 | 188 | // 27) var x = "A"; 189 | // function func() { 190 | // x = "B"; 191 | // } 192 | // func(); 193 | // alert(x); 194 | 195 | 196 | // 28) alert( 197 | // function(){ 198 | // return 10; 199 | // }() 200 | // ); 201 | 202 | 203 | 204 | // 29) alert( 205 | // +function(){ 206 | // alert(10); 207 | // }() 208 | // ); -------------------------------------------------------------------------------- /Class No. 11 (13-11-2016)/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Todo section 6 | 7 | 8 | 9 |
10 |

Todo PAGE

11 | 12 | 13 |
14 |

15 |
    16 |
17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Class No. 11 (13-11-2016)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 11 (13-11-2016)/js/js.js: -------------------------------------------------------------------------------- 1 | var array = []; 2 | 3 | function addTodo() { 4 | var GetInputValue = document.getElementById("input").value; 5 | if (GetInputValue == " " || GetInputValue == "") { // if you want to check all space add a loop 6 | alert("Please write some thing"); 7 | } 8 | else { 9 | array.push(GetInputValue); 10 | } 11 | if (array.length >= 1) { 12 | document.getElementById("heading").innerHTML = "Todo you entered are"; 13 | } 14 | var todoList = document.getElementById("todo_list"); 15 | var data = ""; 16 | for (var i = 0; i < array.length; i++) { 17 | data += "
  • " + array[i] + "
  • "; 18 | todoList.innerHTML = links; 19 | } 20 | data = ""; 21 | document.getElementById("input").value = "" 22 | 23 | } 24 | 25 | function removed() { 26 | document.getElementById("todo_list").innerHTML = ""; 27 | array = [] 28 | } -------------------------------------------------------------------------------- /Class No. 12 (20-11-2016)/1232.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mali521/Batch-4-JS/272b33ff0bb88a170fc018f5bdd53d7eafdbea3f/Class No. 12 (20-11-2016)/1232.jpg -------------------------------------------------------------------------------- /Class No. 12 (20-11-2016)/Delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mali521/Batch-4-JS/272b33ff0bb88a170fc018f5bdd53d7eafdbea3f/Class No. 12 (20-11-2016)/Delete.png -------------------------------------------------------------------------------- /Class No. 12 (20-11-2016)/aa.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mali521/Batch-4-JS/272b33ff0bb88a170fc018f5bdd53d7eafdbea3f/Class No. 12 (20-11-2016)/aa.jpg -------------------------------------------------------------------------------- /Class No. 12 (20-11-2016)/app.js: -------------------------------------------------------------------------------- 1 | // function popup(message){ 2 | // alert(message); 3 | // } 4 | 5 | 6 | // function checkAddress(fieldId) { 7 | // if (document.getElementById(fieldId).value === "") { 8 | // alert("Email address required."); 9 | // } 10 | // } 11 | 12 | function fillCity() { 13 | var cityName; 14 | var zipEntered = document.getElementById("zip").value; 15 | switch (zipEntered) { 16 | case "60608" : 17 | cityName = "Chicago"; break; 18 | case "68114" : cityName = "Omaha"; 19 | break; 20 | case "53212" : 21 | cityName = "Milwaukee"; 22 | } 23 | document.getElementById("city").value = cityName; 24 | } -------------------------------------------------------------------------------- /Class No. 12 (20-11-2016)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 21 |
    ZIP:
    22 | 23 |
    24 | City:
    25 | 26 |
    27 | 28 | 29 | -------------------------------------------------------------------------------- /Class No. 12 (20-11-2016)/todo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 |
    11 |

    Todo App

    12 | 13 | 14 |
    15 |

    16 |
      17 |
    18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Class No. 12 (20-11-2016)/todo.js: -------------------------------------------------------------------------------- 1 | var array = []; 2 | 3 | function addTodo() { 4 | var GetInputValue = document.getElementById("input").value; 5 | if (GetInputValue == " " || GetInputValue == "") { // if you want to check all space add a loop 6 | alert("Please write some thing"); 7 | } 8 | else { 9 | array.push(GetInputValue); 10 | } 11 | if (array.length >= 1) { 12 | document.getElementById("heading").innerHTML = "Todo you entered are"; 13 | } 14 | var todoList = document.getElementById("todo_list"); 15 | var data = ""; 16 | for (var i = 0; i < array.length; i++) { 17 | data += "
  • " + array[i] + document.getElementById("btn")+"
  • "; 18 | todoList.innerHTML = data; 19 | 20 | } 21 | data = ""; 22 | document.getElementById("input").value = "" 23 | 24 | } 25 | 26 | function removedall() { 27 | document.getElementById("todo_list").innerHTML = ""; 28 | array = [] 29 | } 30 | function remove(b) { 31 | var a = document.getElementById("todo_list"); 32 | a.removeChild(b); 33 | } 34 | -------------------------------------------------------------------------------- /Class No. 13 (27-11-2016)/group.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mali521/Batch-4-JS/272b33ff0bb88a170fc018f5bdd53d7eafdbea3f/Class No. 13 (27-11-2016)/group.jpg -------------------------------------------------------------------------------- /Class No. 13 (27-11-2016)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 12 | 13 | 14 | 15 |

    Saylani

    16 | 22 | 23 | -------------------------------------------------------------------------------- /Class No. 13 (27-11-2016)/index1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 14 | 15 | 16 | 17 |

    Hello World

    18 | 21 | 22 | -------------------------------------------------------------------------------- /Class No. 16 (12-11-2016)/app.js: -------------------------------------------------------------------------------- 1 | var d = document.getElementById("humpty"); 2 | var pCounter = 0; 3 | for (var i = 0; i < d.childNodes.length; i++) 4 | { 5 | if (d.childNodes[i].nodeType === 1 ) { 6 | pCounter++; } 7 | if (pCounter === 2) { 8 | d.childNodes[i].innerHTML = "All his men."; 9 | break; } 10 | } -------------------------------------------------------------------------------- /Class No. 16 (12-11-2016)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 |
    10 |

    All the king's horses.

    11 |

    All the dude's crew.

    12 |

    All the town's orthopedists.

    13 |
    14 | 15 | 16 | -------------------------------------------------------------------------------- /Class No. 17 (1-1-2017)/app.js: -------------------------------------------------------------------------------- 1 | var parentDiv = document.getElementById("div1"); 2 | var newParagraph = document.createElement("p"); 3 | var t = document.createTextNode("Hello world!"); 4 | newParagraph.appendChild(t); 5 | parentDiv.appendChild(newParagraph); -------------------------------------------------------------------------------- /Class No. 17 (1-1-2017)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 |
    9 |

    hi

    10 |

    salam

    11 |
    12 | 13 | 14 | -------------------------------------------------------------------------------- /Class No. 18 (7-1-2017)/app.js: -------------------------------------------------------------------------------- 1 | function Plan(name, price, space, transfer, pages) { 2 | this.name = name; 3 | this.price = price; 4 | this.space = space; 5 | this.transfer = transfer; 6 | this.pages = pages; 7 | } 8 | var plan1 = new Plan("Basic", 3.99, 100, 1000, 10); 9 | console.log(plan1); -------------------------------------------------------------------------------- /Class No. 18 (7-1-2017)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 19 (22-1-2017)/QuizApp Snapshot/app.js1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mali521/Batch-4-JS/272b33ff0bb88a170fc018f5bdd53d7eafdbea3f/Class No. 19 (22-1-2017)/QuizApp Snapshot/app.js1.png -------------------------------------------------------------------------------- /Class No. 19 (22-1-2017)/QuizApp Snapshot/app.js2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mali521/Batch-4-JS/272b33ff0bb88a170fc018f5bdd53d7eafdbea3f/Class No. 19 (22-1-2017)/QuizApp Snapshot/app.js2.png -------------------------------------------------------------------------------- /Class No. 19 (22-1-2017)/QuizApp Snapshot/app.js3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mali521/Batch-4-JS/272b33ff0bb88a170fc018f5bdd53d7eafdbea3f/Class No. 19 (22-1-2017)/QuizApp Snapshot/app.js3.png -------------------------------------------------------------------------------- /Class No. 19 (22-1-2017)/QuizApp Snapshot/index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mali521/Batch-4-JS/272b33ff0bb88a170fc018f5bdd53d7eafdbea3f/Class No. 19 (22-1-2017)/QuizApp Snapshot/index.png -------------------------------------------------------------------------------- /Class No. 2 (11-9-16)/app.js: -------------------------------------------------------------------------------- 1 | var a = 1+1-3; 2 | a = a + 5; 3 | a = 5 + a; 4 | alert(a); 5 | 6 | // + - * / ++ -- % 7 | // = += -= != 8 | // == < > <= >= === && || 9 | 10 | var b = 1; 11 | alert(b++); 12 | 13 | var c = 1; 14 | alert(++c); 15 | 16 | var d = 1; 17 | alert(d--); 18 | 19 | var e = 1; 20 | alert(e--); 21 | 22 | var b = 1; 23 | alert(b++); 24 | 25 | var e = 5; 26 | e = 6; 27 | alert(e); 28 | 29 | var f = 5; 30 | f = f++ + 5; 31 | // 5 + 5 = 10 (result) 32 | // 5 + 1 = 6 (result save in f after post increment) 33 | // f = 10 34 | 35 | var f = 5; 36 | f = ++f + 5; 37 | // 5 + 1 = 6(result save in f) 38 | // 6 + 5 = 11 (result) 39 | // f = 11 40 | 41 | f = 5; 42 | f = 6; 43 | f = 10; 44 | 45 | var g = "My name is: "; 46 | console.log(g + "Ali"); -------------------------------------------------------------------------------- /Class No. 2 (11-9-16)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 3 (18-9-16)/Assignment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 3 (18-9-16)/Assignment.js: -------------------------------------------------------------------------------- 1 | //var a = prompt ("Enter string","Your string"); 2 | //var b = prompt ("Enter string","Your string"); 3 | //var c = a + b ; 4 | //alert(c); 5 | 6 | 7 | //var x = prompt ("Enter Number","Your number"); 8 | //var y = prompt ("Enter Number","Your Number"); 9 | //var z = parseInt(x) + parseInt(y) ; 10 | //alert(z); 11 | 12 | //Arithmatic Operators 13 | // + , - , / , % , * 14 | 15 | //Comparison Operators: 16 | // < , > , <= , >= , === , !== 17 | 18 | //Logical Operators: 19 | // && , || 20 | 21 | 22 | //var a = prompt ("Enter your Name"); 23 | //if ( a === "Ahmed"){ 24 | // console.log("True"); 25 | //} 26 | //else{ 27 | // console.log("False"); 28 | //} 29 | 30 | 31 | var x = prompt("Enter your Percentage", "Your Percentage"); 32 | if(x <= 100 && x >= 90){ 33 | alert("A+"); 34 | } 35 | else if (x < 90 && x >=80){ 36 | alert("A"); 37 | } 38 | else if (x < 80 && x >=70){ 39 | alert("B"); 40 | } 41 | else if (x < 70 && x >=60){ 42 | alert("C"); 43 | } 44 | else if (x < 60 && x >=50){ 45 | alert("D"); 46 | } 47 | else if (x < 50 && x >=40){ 48 | alert("E"); 49 | } 50 | else { 51 | alert("F"); 52 | } 53 | 54 | 55 | 56 | if ((SAT > avg && GPA > 2.5) || sport === "football") { 57 | alert("Welcome to Bubba State!"); 58 | } 59 | else { 60 | alert("Have you looked into appliance repair?"); 61 | } -------------------------------------------------------------------------------- /Class No. 3 (18-9-16)/New Text Document.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mali521/Batch-4-JS/272b33ff0bb88a170fc018f5bdd53d7eafdbea3f/Class No. 3 (18-9-16)/New Text Document.txt -------------------------------------------------------------------------------- /Class No. 4 (25-9-16)/app.js: -------------------------------------------------------------------------------- 1 | // // //Array:- 2 | 3 | 4 | // // var a = ["dog", "cow" ,"cat" , "elephant"]; 5 | 6 | 7 | // // Push Method(It inserts at the end of array):- 8 | // // a.push("bull","lion"); 9 | 10 | 11 | // // Pull Method (It deletes at the end of array) :- 12 | // // a.pull(); 13 | 14 | 15 | // Shift Method(It inserts in the begining of array):- 16 | // a.shift("goat"); 17 | 18 | 19 | // Unshift Method(It deletes in the begining of array):- 20 | // a.unshift(); 21 | 22 | 23 | // Splice (1st digit represents : From where u want to start insertion and deletion) 24 | // (2nd digit represents : Number of elements u wanna delete ) 25 | // (3rd part represents : Which elements u want to insert ) 26 | // a.splice(2,2,"snake", "rabbit"); 27 | 28 | 29 | // Slice (It copies part of array to new array) 30 | // (1st digit represents : starting index from where it will start copying) 31 | // (2nd digit represents : +1 ending index where it will stop copying) 32 | // var b = a.slice(2,5); -------------------------------------------------------------------------------- /Class No. 4 (25-9-16)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 5 (2-10-16)/app.js: -------------------------------------------------------------------------------- 1 | //console.log(1); 2 | //console.log(2); 3 | //console.log(3); 4 | //console.log(4); 5 | //console.log(5); 6 | 7 | 8 | // Kinds of Loops: 9 | // 1, for loop 10 | // 2, foreach 11 | // 3, while loop 12 | // 4, dowhile loop 13 | 14 | 15 | // FOR LOOP : 16 | 17 | //for(var i = 0; i < 10; i++ ){ 18 | //console.log(i); 19 | //} 20 | 21 | 22 | // var i; 23 | // for(i = 0 ; i <= 50 ; i = i + 1){ 24 | // console.log(i); 25 | // } 26 | 27 | 28 | // var i; 29 | // for(i = 0 ; i <= 50 ; i = i + 5){ 30 | // console.log(i); 31 | // } 32 | 33 | 34 | // var cities = ["Karachi", "Hyderabad", "Lahore" , "Quetta" ]; 35 | // for (var moiz = 0; moiz <= cities.length - 1 ; moiz++){ 36 | // console.log("Best city of Pakistan " + cities[moiz]); 37 | // } 38 | 39 | 40 | // var cityToCheck = prompt("Enter your city"); 41 | // var cleanestCities = ["Karachi", "Hyderabad", "Lahore" , "Quetta" ]; 42 | // for (var i = 0; i <= 4; i++) { 43 | // if (cityToCheck === cleanestCities[i]) { 44 | // alert("It's one of the cleanest cities"); 45 | // } 46 | // } 47 | 48 | 49 | // var cityToCheck = prompt("Enter your city"); 50 | // var cleanestCities = ["Karachi", "Hyderabad", "Lahore" , "Quetta" ]; 51 | // var matchFound = false; 52 | // for (var i = 0; i < 4; i++) { 53 | // if (cityToCheck === cleanestCities[i]) { 54 | // matchFound = true; 55 | // alert("It's one of the cleanest cities"); 56 | // } 57 | // } 58 | // if (matchFound === false) { 59 | // alert("It's not on the list"); 60 | // } 61 | 62 | 63 | var firstNames = ["BlueRay ", "Upchuck ", "Lojack ", "Gizmo ", "Do-Rag "]; 64 | var lastNames = ["Zzz", "Burp", "Dogbone", "Droop"]; 65 | var fullNames = []; 66 | for (var i = 0; i < firstNames.length; i++) { 67 | for (var j = 0; j < lastNames.length; j++) { 68 | fullNames.push(firstNames[i] + lastNames[j]); 69 | } 70 | } 71 | console.log(fullNames); -------------------------------------------------------------------------------- /Class No. 5 (2-10-16)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 6 (9-10-16)/app.js: -------------------------------------------------------------------------------- 1 | var str = prompt("Enter some text"); 2 | var numChars = str.length; 3 | for (var i = 0; i < numChars; i++) { 4 | if (str.slice(i, i + 2) === " ") { 5 | alert("no double spaces!"); 6 | } 7 | } -------------------------------------------------------------------------------- /Class No. 6 (9-10-16)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 7 (16-10-16)/app.js: -------------------------------------------------------------------------------- 1 | // var text = "It is startling to think that, even in the darkest depths of World War II, J. R. R. Tolkien was writing the trilogy, which contains, with the weird applicability available only to poetry and myth, the essential notion that the good gray wizard can understand the evil magi precisely because he is just enough like them to grasp their minds and motives in ways that they cannot grasp his. "; 2 | // for (var i = 0; i < text.length; i++) { 3 | // if (text.slice(i, i + 12) === "World War II") { 4 | // text = text.slice(0, i) + "the Second World War" + text.slice(i + 12); 5 | // } 6 | // } 7 | // console.log(text); 8 | 9 | 10 | // var text = "My name is Muhammad Ali"; 11 | // var findingindex = text.indexOf("are"); 12 | // console.log(findingindex); 13 | 14 | // var firstChar = text.indexOf("World War II"); 15 | // if (firstChar !== -1) { 16 | // text = text.slice(0, firstChar) + "the Second World War" + text.slice(firstChar + 12); 17 | // } 18 | // console.log(text); 19 | 20 | // var a = "this is a class which is a good class"; 21 | // var b = a.lastIndexOf("is"); 22 | // console.log(b); 23 | 24 | // var name = "Muhammad Ali"; 25 | // var firstChar = name.charAt(name.length - 1); 26 | // console.log(firstChar); 27 | 28 | // var score = .0678437; 29 | // var roundofvalue = Math.round(score); 30 | // console.log(roundofvalue); 31 | 32 | 33 | // var score = .0678437; 34 | // var roundofvalue = Math.ceil(score); 35 | // console.log(roundofvalue); 36 | 37 | 38 | // var score = 7.9678437; 39 | // var roundofvalue = Math.floor(score); 40 | // console.log(roundofvalue); 41 | 42 | 43 | 44 | // var randomValue = Math.random() * 10 ; 45 | // var finalWinner = Math.round(randomValue); 46 | // console.log(finalWinner); 47 | 48 | 49 | // var a = +prompt("Enter your value"); 50 | // console.log(a + 1); 51 | 52 | // var a = prompt("Enter your value"); 53 | // console.log(parseInt(a) +1); 54 | 55 | // var a = prompt("Enter your value"); 56 | // console.log(+a +1); -------------------------------------------------------------------------------- /Class No. 7 (16-10-16)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 8 (23-10-2016)/app.js: -------------------------------------------------------------------------------- 1 | var arr = [1,2,3,5,8,5,2,10,5] 2 | 3 | var found = 0; 4 | for(var i = 0; i < arr.length; i++){ 5 | console.log("arr[i] == 5", arr[i], 5) 6 | if(arr[i] == 5){ 7 | found++; 8 | } 9 | } 10 | 11 | console.log(found) 12 | 13 | 14 | 15 | var arr = [1,2,3,5,8,5,2,10,5] 16 | 17 | var found = false; 18 | for(var i = 0; i < arr.length; i++){ 19 | if(arr[i] == 5){ 20 | found = true; 21 | break; 22 | } 23 | } 24 | console.log(found) 25 | 26 | 27 | 28 | var a = Date.now(); 29 | for(var i = 0; i < 100; i++){ 30 | console.log(i); 31 | } 32 | console.log(Date.now() - a) 33 | 34 | 35 | 36 | 37 | 38 | var arr = [1,2,3,5,8,5,2,10,5] 39 | 40 | var found = false; 41 | var found2=false; 42 | for(var i = 0; i < arr.length; i++){ 43 | if(arr[i] == 1){ 44 | found = true; 45 | } 46 | if(arr[i] == 2){ 47 | found2=true; 48 | } 49 | if(found==true && found2==true){ 50 | console.log("true"); 51 | break; 52 | } 53 | } 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | var arr = [2,1,3,5,8,5,2,10,5] 67 | 68 | var found = false; 69 | for(var i = 0; i < arr.length; i++){ 70 | if(arr[i] == 1){ 71 | for(var j = 0; j < arr.length; j++){ 72 | if(arr[j]==2){ 73 | found=true; 74 | break; 75 | } 76 | } 77 | break; 78 | } 79 | 80 | 81 | } 82 | 83 | if(found==true ){ 84 | console.log("true"); 85 | } 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | var arr = [2,1,3,5,8,5,2,10,5] 95 | 96 | var found = false; 97 | for(var i = 0; i < arr.length; i++){ 98 | if(arr[i] == 1 || arr[i] == 2){ 99 | found=true; 100 | break; 101 | } 102 | } 103 | 104 | if(found==true ){ 105 | console.log("true"); 106 | } 107 | 108 | 109 | 110 | 111 | 112 | var arr = [2,1,3,5,8,5,2,10,5] 113 | 114 | var found = false; 115 | for(var i = 0; i < arr.length; i++){ 116 | if(arr[i] == 1 || arr[i] == 2){ 117 | if(!found){ 118 | if(found != arr[i]){ 119 | console.log("TRUE"); 120 | break; 121 | } 122 | } else { 123 | console.log("SET foun") 124 | found = arr[i]; 125 | } 126 | } 127 | } 128 | 129 | var arr = [2,1,3,5,8,5,2,10,5] 130 | 131 | var found = false; 132 | for(var i = 0; i < arr.length; i++){ 133 | if(arr[i] == 1 || arr[i] == 2){ 134 | if(found && found != arr[i]){ 135 | console.log("true"); 136 | break; 137 | } 138 | found = arr[i]; 139 | } 140 | } 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | var arr = [2,1,3,5,8,5,2,10,5,2,1,3,5,8,5,2,10,5,2,1,3,5,8,5,2,10,5,2,1,3,5,8,5,2,10,5] 154 | 155 | var found = false; 156 | for(var i = 0; i < arr.length; i++){ 157 | if(arr[i] == 1 || arr[i] == 2){ 158 | if(found && found != arr[i]){ 159 | console.log("true"); 160 | break; 161 | } 162 | found = arr[i]; 163 | } 164 | } 165 | 166 | 167 | 168 | var needToFound = [1,2, 200, 300, 5] 169 | var arr = [2,1,3,5,8,5,2,10,5,2,1,3,5,8,5,2,10,5,2,1,3,5,8,5,2,10,5,2,1,3,5,8,5,2,10,5, 200, 300] 170 | 171 | for(var i = 0; i < needToFound.length; i++){ 172 | var index = arr.indexOf(needToFound[i]); 173 | if(index != -1){ 174 | needToFound.splice(i,1); 175 | i--; 176 | } 177 | } 178 | if(!needToFound.length){ 179 | console.log("Found All") 180 | } else { 181 | console.log("Not Found these numbers : " + needToFound.join(",,")); 182 | } 183 | 184 | 185 | //Write a program to find multiple numbers 186 | // a) With indexOf 187 | // b) -------------------------------------------------------------------------------- /Class No. 8 (23-10-2016)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Class No. 9 (30-10-2016)/app.js: -------------------------------------------------------------------------------- 1 | //var date = new Date(); 2 | //alert(date); 3 | //var Instring = date.toString(); 4 | //var date1 = Instring.slice(8,10); 5 | //alert(date1); 6 | 7 | //var date2 = date.getTime(); 8 | //alert(date2); 9 | 10 | // var currentTime = new Date(); 11 | // var nextTime = new Date("Jan 20, 2025"); 12 | // var time1 = currentTime.getTime(); 13 | // var time2 = nextTime.getTime(); 14 | // var Diff = time2 - time1; 15 | // var TofindDay = Diff / (1000*60*60*24); 16 | // var finalValue = Math.floor(TofindDay); 17 | // alert(finalValue); 18 | 19 | // var d = new Date(); 20 | // d.setFullYear(2001); 21 | // alert(d); 22 | 23 | 24 | //General Syntax: 25 | 26 | // function func(){ 27 | // alert("My first function") 28 | // } 29 | 30 | // func(); 31 | 32 | // var func2 = function(){ 33 | // alert("My first function") 34 | // } 35 | 36 | // func2(); 37 | 38 | 39 | 40 | // function greet(){ 41 | // alert("Hello World"); 42 | // } 43 | 44 | // greet(); 45 | 46 | 47 | // function greet(greetings){ 48 | // alert(greetings); 49 | // } 50 | // greet("Hello World"); 51 | 52 | 53 | function Addition(a,b,c){ 54 | alert(a+b+c); 55 | } 56 | Addition(2,3,4); -------------------------------------------------------------------------------- /Class No. 9 (30-10-2016)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 8 | 9 | 10 | 11 | --------------------------------------------------------------------------------