Skip to content

Commit 0131ae1

Browse files
more solved
1 parent 74cb520 commit 0131ae1

File tree

4 files changed

+69
-5
lines changed

4 files changed

+69
-5
lines changed

index.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
<title>Learning JavaScript</title>
88
</head>
99
<body>
10-
<h1>Practising JavaScript "Assaigment"</h1>
10+
<h1 style="text-align: center; padding-top: 30px;">All JavaScript Assaignment is there. It has Two JS file. </h1>
1111

12-
<script src="problems.js"></script>
12+
<script src="problemsOne.js"></script>
13+
<script src="problemsTwo.js"></script>
1314

1415
</body>
1516
</html>

problems.js renamed to problemsOne.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
console.log("this number is odd")
7676
}
7777

78-
// problem 06
78+
// ----------------problem 06--------------------
7979
//solve the problem with Javascript to check whether a character is in the alphabet or not. [solve hoyni, baki ase]
8080

8181
// function alphanumeric(inputtxt)
@@ -209,7 +209,7 @@
209209
//Create a function which returns a for loop which takes two parameter one is initial value & final value to return the list of number from initial to final value
210210

211211
function forLoop(initialValue, finalValue) {
212-
for(let k = initialValue; k <= finalValue; k++){
212+
for(let k = initialValue; k <= finalValue; k++) {
213213
console.log(k);
214214
}
215215
}
@@ -258,4 +258,8 @@
258258
console.log(findthenumber, "is an even humber");
259259
} else {
260260
console.log(findthenumber, "is an odd number");
261-
}
261+
}
262+
263+
264+
265+

problemsTwo.js

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// ------------problem 18------------
2+
// splice = adding new items to an array
3+
// slice = removing items from an Array
4+
// splice and a given array - remove two items and adding two new elements
5+
6+
let cars = ["audi", "farrari", "marcedes", "toyota", "volvo"];
7+
8+
let splice = cars.splice(2, 0, "RollsRoyes", "Tesla")
9+
console.log(cars);
10+
11+
let players = ["tamim", "shakib", "riad", "rubel"];
12+
13+
let slice = players.slice(2);
14+
console.log(slice);
15+
16+
17+
18+
19+
//----------------problem 19-------------
20+
//Reverse and sort an array where arr = [2,45,4,55,12,42,34,78]
21+
22+
let newNumbers = [2,45,4,55,12,42,34,78];
23+
24+
console.log(newNumbers.sort(function(x, y){return x - y}));
25+
// console.log(newNumbers.reverse(function(x, y){return x - y})); //comment-out this one to see the answers for Reverse Array
26+
27+
28+
29+
30+
//----------------problem 20-------------
31+
//Create an object with car and add two function in there (called methods as well) and print out the result calling two functions using this keyword as well
32+
33+
34+
35+
//----------------problem 21-------------
36+
//Reverse a given string. Where, - let text = “I love coding” - after reverse a string output will be - ‘gnidoc evol i’
37+
38+
const text = "I love coding";
39+
40+
let newText = "";
41+
for(let i = text.length - 1; i >= 0; i--) {
42+
newText += text[i];
43+
}
44+
45+
console.log(newText);
46+
47+
48+
49+
//----------------problem 22-------------
50+
//Create an array with list of items. Iterate the array to view the list of the items in the console using for loop.
51+
52+
let managers = ["karim", "rahim", "abdal", "rasel", "rajon", "charles", "Fahim"];
53+
54+
for (let i=0; i <= managers.length; i++) {
55+
console.log(managers[i]);
56+
}
57+
58+
59+

style.css

Whitespace-only changes.

0 commit comments

Comments
 (0)