Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions js/js_part3/assignment.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Assignment part 3</title>
<script src="assignment.js"></script>
</head>
<body>
<h1>Assignment</h1>
</body>
</html>
51 changes: 51 additions & 0 deletions js/js_part3/assignment.js
Original file line number Diff line number Diff line change
@@ -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')
}
12 changes: 12 additions & 0 deletions js/js_part4/assignment.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Assignment part 4</title>
<script src="assignment.js"></script>
</head>
<body>
<h1>Assignment</h1>
</body>
</html>
14 changes: 14 additions & 0 deletions js/js_part4/assignment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//Question 1
let arr = [1,2,3,4,5,6,2,3]
let num = 2
let i = 0
while(i<arr.length){
if(arr[i]==num){
arr.splice(i,1);
}
i++;
}
console.log(arr)

//Question 2
let num1 = 6642120
12 changes: 12 additions & 0 deletions js/js_part4/practice.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Practice</title>
<script src="practice.js"></script>
</head>
<body>
<h1>Practice</h1>
</body>
</html>
11 changes: 11 additions & 0 deletions js/js_part4/practice.js
Original file line number Diff line number Diff line change
@@ -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;
}
5 changes: 5 additions & 0 deletions js/notes.txt
Original file line number Diff line number Diff line change
@@ -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