From e21c44bb849801e3f4b57400efada4852c88de9a Mon Sep 17 00:00:00 2001 From: codal-tshah Date: Thu, 17 Oct 2024 11:37:09 +0530 Subject: [PATCH 1/4] CIT-539 #time 2h Compledted the Javascript learning Part 4 --- js/js_part4/assignment.html | 12 ++++++++++++ js/js_part4/assignment.js | 14 ++++++++++++++ js/js_part4/practice.html | 12 ++++++++++++ js/js_part4/practice.js | 11 +++++++++++ js/notes.txt | 3 +++ 5 files changed, 52 insertions(+) create mode 100644 js/js_part4/assignment.html create mode 100644 js/js_part4/assignment.js create mode 100644 js/js_part4/practice.html create mode 100644 js/js_part4/practice.js diff --git a/js/js_part4/assignment.html b/js/js_part4/assignment.html new file mode 100644 index 0000000..6c81906 --- /dev/null +++ b/js/js_part4/assignment.html @@ -0,0 +1,12 @@ + + + + + + Assignment part 4 + + + +

Assignment

+ + \ No newline at end of file diff --git a/js/js_part4/assignment.js b/js/js_part4/assignment.js new file mode 100644 index 0000000..50c044b --- /dev/null +++ b/js/js_part4/assignment.js @@ -0,0 +1,14 @@ +//Question 1 +let arr = [1,2,3,4,5,6,2,3] +let num = 2 +let i = 0 +while(i + + + + + Practice + + + +

Practice

+ + \ No newline at end of file diff --git a/js/js_part4/practice.js b/js/js_part4/practice.js new file mode 100644 index 0000000..68c0911 --- /dev/null +++ b/js/js_part4/practice.js @@ -0,0 +1,11 @@ +console.log('List of even numbers upto 20'); +for(let a=2; a<=20; a=a+2 ){ + console.log(a); +} + +console.log('Printing the 13s table using while loop:') +let b = 13 +while(b<=130){ + console.log(b); + b=b+13; +} \ No newline at end of file diff --git a/js/notes.txt b/js/notes.txt index a3485c3..30ab98d 100644 --- a/js/notes.txt +++ b/js/notes.txt @@ -1,2 +1,5 @@ 16_oct - completed the javascript learning of part 3 +17-oct +- completed the javascript learning of part 4 +- learn the for loops and while loops also nested loops \ No newline at end of file From b2d4584fc605e593ba7da5929379e6824c5273eb Mon Sep 17 00:00:00 2001 From: codal-tshah Date: Mon, 21 Oct 2024 14:15:21 +0530 Subject: [PATCH 2/4] CIT-539 #time 2h Completed the JavaScript learning Part 5 --- js/js_part5/assignment.html | 12 ++++++++++++ js/js_part5/assignment.js | 31 +++++++++++++++++++++++++++++++ js/notes.txt | 6 +++++- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 js/js_part5/assignment.html create mode 100644 js/js_part5/assignment.js diff --git a/js/js_part5/assignment.html b/js/js_part5/assignment.html new file mode 100644 index 0000000..df21a9a --- /dev/null +++ b/js/js_part5/assignment.html @@ -0,0 +1,12 @@ + + + + + + Assignment part 5 + + + +

Assignment 5

+ + \ No newline at end of file diff --git a/js/js_part5/assignment.js b/js/js_part5/assignment.js new file mode 100644 index 0000000..7ac90d4 --- /dev/null +++ b/js/js_part5/assignment.js @@ -0,0 +1,31 @@ +// Qsl . Create a program that generates a random number representing a dice roll. +// [The number should be between 1 and 6]. + +let max_rolled = 6 +let dice = Math.random() +console.log("The number you got after rolling a dice: ",Math.floor(dice * max_rolled)+1) + + +// Qs2. Create an object representing a car that stores the following properties for the +// car: name, model, color. +// Print the car's name. + +let car={ + name:"Nissan Sunny", + model:"XL", + color:"silver" +} +console.log("car name is :",car.name) + +// Qs3. Create an object Person with their name, age and city. +// Edit their city's original value to change it to "New York". +// Add a new property country and set it to the United States. + +let person={ + name:"helly", + age:"21", + city:"Godhra" +} +console.log("my object:",person.city="New York") +person.country="United States" +console.log("new profile",person) \ No newline at end of file diff --git a/js/notes.txt b/js/notes.txt index 30ab98d..171fd68 100644 --- a/js/notes.txt +++ b/js/notes.txt @@ -2,4 +2,8 @@ - completed the javascript learning of part 3 17-oct - completed the javascript learning of part 4 -- learn the for loops and while loops also nested loops \ No newline at end of file +- learn the for loops and while loops also nested loops +21_oct +- completed learning javascript part 5 +- learn some randome and maths functions and how to use it. +- also learned the objects and arrays \ No newline at end of file From ccd59b11c901fd903fa1646c00560febb6eb35f8 Mon Sep 17 00:00:00 2001 From: codal-tshah Date: Mon, 21 Oct 2024 15:52:40 +0530 Subject: [PATCH 3/4] CIT-539 Completed JavaScript learning Part 6 --- js/js_part6/assignment.html | 12 +++++++++ js/js_part6/assignment.js | 53 +++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 js/js_part6/assignment.html create mode 100644 js/js_part6/assignment.js diff --git a/js/js_part6/assignment.html b/js/js_part6/assignment.html new file mode 100644 index 0000000..25888aa --- /dev/null +++ b/js/js_part6/assignment.html @@ -0,0 +1,12 @@ + + + + + + Assignment part 6 + + + +

Assignment 6

+ + \ No newline at end of file diff --git a/js/js_part6/assignment.js b/js/js_part6/assignment.js new file mode 100644 index 0000000..096ca1b --- /dev/null +++ b/js/js_part6/assignment.js @@ -0,0 +1,53 @@ +// Qsl. Write a JavaScript function that returns array elements larger than a number. + + +let fungt = function(num){ + let myArray = [5,6,9,2,0,20,6,33,1,3] + for (let i=0;i<=myArray.length;i++){ + if(num Date: Mon, 21 Oct 2024 20:38:35 +0530 Subject: [PATCH 4/4] CIT-539 Completed JavaScript learning Part 7 --- js/js_part7/assignment.html | 12 ++++++++++++ js/js_part7/assignment.js | 39 +++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 js/js_part7/assignment.html create mode 100644 js/js_part7/assignment.js diff --git a/js/js_part7/assignment.html b/js/js_part7/assignment.html new file mode 100644 index 0000000..c419464 --- /dev/null +++ b/js/js_part7/assignment.html @@ -0,0 +1,12 @@ + + + + + + Assignment part 7 + + + +

Assignment 7

+ + \ No newline at end of file diff --git a/js/js_part7/assignment.js b/js/js_part7/assignment.js new file mode 100644 index 0000000..e2f9981 --- /dev/null +++ b/js/js_part7/assignment.js @@ -0,0 +1,39 @@ +// Qsl . Write an arrow function named arrayAverage that accepts an array of numbers +// and returns the average of those numbers. + +let arrayAverage = (arr) => { + let total = 0; + for (let number of arr){ + total += number + } + return total / arr.length; + +} +arr = [10,20,30,40] +console.log(arrayAverage(arr)) + + + +// Qs2. Write an arrow function named isEven() that takes a single number as argument +// and returns if it is even or not. + + +let isEven = (number) => { + if(number%2 == 0){ + console.log("is even number") + }else{ + console.log('Not even number') + } +} +let number = 51 +isEven(number) + + +// Question 3 +const object={ + message:'Hello,World!', + logMessage(){ + console.log(this.message); + } +}; +setTimeout(object.logMessage, 1000); \ No newline at end of file