Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f9c8b8c

Browse files
Update README.md
Final Update after addition of new Questions
1 parent b39bda5 commit f9c8b8c

File tree

1 file changed

+164
-1
lines changed

1 file changed

+164
-1
lines changed

‎README.md‎

Lines changed: 164 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,21 @@ let arrowFunction = (name ="Coders") => {`Welcome ${name}`};
164164
console.log(arrowFunction("Programmers"));
165165
```
166166

167+
**Question 8:** Create a JavaScript **Function** to find the area of a triangle where lengths of the three of its sides are 5, 6, 7
168+
169+
```js
170+
input : area_of_triangle(5,6,7)
171+
output : 14.69
172+
```
173+
**Question 9:** Create a JavaScript **Function** to capitalize the first letter of each word of a given string.
174+
```js
175+
176+
input : capitalize("we are the champions")
177+
output : "We Are The Champions"
178+
179+
180+
```
181+
167182
## Chapter 4 (Objects)
168183

169184
### Assignments
@@ -238,6 +253,14 @@ for(let elem in arr){
238253
}
239254
```
240255

256+
**Question 9:** You have to create a **Shopping_Cart** array with following features :
257+
258+
- **addItem(itemName)** : this function should add string itemName to cart
259+
260+
- **removeItem(itemName)**: this function should remove any item which matches itemName. _Hint : search for index of itemName and then remove it_
261+
262+
- **cartSize()** : returns size of cart in terms of number of cart Items.
263+
241264

242265
## Chapter 5 (DOM)
243266

@@ -387,11 +410,70 @@ let arr = [1,2,3,4];
387410
let result = arr.splice(1,2).pop();
388411
console.log(result);
389412
```
390-
**Question 13:** You have given an array of numbers **nums**. You have to check if all elements of the **array > 15** using **built-in** array method.
413+
**Question 13:** You have `given an array of numbers **nums**. You have to check if all elements of the **array > 15** using **built-in** array method.
391414
```js
392415
let nums = [16,17,18,28,22];
393416
```
394417

418+
### More Practice Questions (Arrays)
419+
420+
**Question 1:** Guess the **Output** And explain Why?
421+
422+
```js
423+
let strArray = [1,2,3,4,5];
424+
let result = strArray.reverse();
425+
console.log(result == strArray);
426+
```
427+
**Question 2:** You have **given** two **arrays** below as an example. Your task is to **combine** them into one By using array method
428+
```js
429+
input
430+
let arr1 = [1,2,3,4,5];
431+
let arr2 = [6,7,8,9,10];
432+
ouput
433+
[6,7,8,9,10,1,2,3,4,5]
434+
```
435+
**Question 3:** You have given an array of **letters** below. Convert that array into string of letters **Without Space**
436+
437+
```js
438+
input
439+
let arr = ['a','b','h','i','s','h','e','k'];
440+
output
441+
'abhishek'
442+
```
443+
444+
**Question 4:** Guess the **Output** and explain why?
445+
```js
446+
let arr = [11,62,1,27,8,5];
447+
let sorted = arr.sort();
448+
console.log(sorted)
449+
```
450+
451+
**Question 5:** Create a function 'calcAverageHumanAge', which accepts an arrays of dog's ages ('ages'), and does the following thing in order:
452+
1. Calculate the dog age in human years using the following formula: if the dog is <= 2 years old, humanAge = 2 * dogAge. If the dog is > 2 years old, humanAge = 16 + dogAge
453+
```js
454+
Test data
455+
456+
let arr = [12,2,5,12,8,13,9];
457+
```
458+
459+
**Question 6:** Guess the **Output** and Explain Why?
460+
461+
```js
462+
let arr = [1,2,3,4,5,6,7,8]
463+
let elem = arr.at(-1);
464+
console.log(elem);
465+
```
466+
467+
**Question 7:** Guess the **Output** and Explain why?
468+
```js
469+
let arr = [1,2,3,4,5,6,7,8]
470+
let result = arr.slice(2,5).splice(0,2,21).pop();
471+
console.log(result,arr)
472+
```
473+
474+
475+
476+
395477
## Chapter 8 (Date and Time)
396478

397479
### Assignments
@@ -648,6 +730,81 @@ for(let key of nums) {
648730
}
649731
```
650732
733+
### More Practice Questions
734+
735+
**Question 1:** Guess the **Output** and Explain Why?
736+
```js
737+
let arr = [1,2,3,4,5];
738+
let arr1 = [...arr];
739+
arr1[2] = 10;
740+
console.log(arr,arr1)
741+
```
742+
**Question 2:** You have given a list of variable names written in underscore. You have to write a program to convert them into camel casing format
743+
744+
```js
745+
List of variable names
746+
747+
Input
748+
user_name
749+
last_name
750+
date_of_birth
751+
user_password
752+
753+
Output
754+
userName
755+
lastName
756+
dateOfBirth
757+
userPassword
758+
```
759+
**Question 3:** Guess the **Output** and Explain why?
760+
761+
```js
762+
function fun(a,b,...c){
763+
console.log(`${a} ${b}`);
764+
console.log(c);
765+
console.log(c[0]);
766+
console.log(c.length);
767+
console.log(c.indexOf('google'));
768+
}
769+
fun('apple','sumsung','amazon','google','facebook')
770+
```
771+
**Question 4:** Guess the **Output** and Explain Why?
772+
```js
773+
const fruits = { apple: 8, orange: 7, pear: 5 };
774+
const entries = Object.entries(fruits);
775+
for (const [fruit, count] of entries) {
776+
console.log(`There are ${count} ${fruit}s`);
777+
}
778+
```
779+
780+
**Question 5:** Write a program in which you have to set **Default** value in case of false input value using **Logical Assignment** Operator?
781+
782+
**Question 6:** Guess the **Output** and Explain Why?
783+
```js
784+
let arr = new Set([1,2,3,1,2,1,3,4,6,7,5]);
785+
let length = arr.size;
786+
console.log(arr,length);
787+
```
788+
789+
**Question 7:** You have given **Set** below. Your task is to convert that **Set** into an **array**?
790+
791+
```js
792+
input
793+
let set = new Set[1,2,3,2,1,3,4,12,2];
794+
output
795+
let arr = "Do something here to convert....";
796+
```
797+
798+
**Question 8:** Guess the **Output** and Explain Why?
799+
**Note** : **Change** values of variable to examine the result.
800+
```js
801+
let number = 40;
802+
let age = 18;
803+
let result = number > 50 ? age > 19 ? 'pass':'ageIssue' : "numberIssue" ;
804+
console.log(result);
805+
```
806+
807+
651808
## Chapter 13 (Modern Tooling)
652809
653810
### Assignments
@@ -660,3 +817,9 @@ write an **import** and **export** statement properly in order to import these t
660817
**Question 2** Now **export** only one method **createProduct** using **default** export statement?
661818
662819
**Question 3:** In **importing** statement how can we **customize**/**change** the name of **function** we are importing?
820+
821+
```js
822+
Example Actuall function name = 'Addition'
823+
We want to import as 'Add'
824+
How can can we do this?
825+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /