diff --git a/js/js_part3/assignment.html b/js/js_part3/assignment.html new file mode 100644 index 0000000..bd90188 --- /dev/null +++ b/js/js_part3/assignment.html @@ -0,0 +1,12 @@ + + + + + + Assignment part 3 + + + +

Assignment

+ + \ No newline at end of file diff --git a/js/js_part3/assignment.js b/js/js_part3/assignment.js new file mode 100644 index 0000000..c3a338e --- /dev/null +++ b/js/js_part3/assignment.js @@ -0,0 +1,51 @@ +//Question 1 +let numberArray = [8,9,0,7,2,-2,0,600,59] +let n = 6 + +let ans = numberArray.slice(0,n) +console.log(ans) + +//Question 2 +let newArray = [8,9,0,7,2,-2,0,600,59] +let num = 3 + +let result = newArray.slice(-num) +console.log(result) + + +//Question 3 +let mystring = " lo diwdwhd woisw wp "; +let check = mystring.trim(); +console.log('after slicing mystring:',check) +if (check==""){ + console.log('mystring is empty') +}else{ + console.log('mystring is not empty:',mystring) +} + +//Question 4 +let char = 'p'; +console.log('character : ', char) +let lowercase = char.toLowerCase(); +if(char == lowercase){ + console.log('Given character is in lowercase') +}else{ + console.log('character is in uppercase', char) +} + +//Question 5 +let theString = ' Vingadium Leviyosa ' +console.log('string is:', theString) +console.log('After removing whitespaces string is :', theString.trim()) + + +//Question 6 +let company = ['microsoft', 'apple', 'blackrock', 'tcs'] +console.log('list of company:', company) +let checkCompany = 'apple' +console.log('company name:', checkCompany) +if(company.includes(checkCompany)){ + console.log('company exists') +}else{ + console.log('company doesnt exist') +} \ No newline at end of file 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 new file mode 100644 index 0000000..30ab98d --- /dev/null +++ b/js/notes.txt @@ -0,0 +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