Skip to content

Commit 2b5edc1

Browse files
committed
questions solved
1 parent 5575b47 commit 2b5edc1

File tree

2 files changed

+177
-1
lines changed

2 files changed

+177
-1
lines changed

js_notes/README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
This is my complete patha nd roadmap with the code i have practised to master javascript.
2+
This documentation of my journey will be the proof of my work and improvement
3+
4+
progression and topics learned
5+
1. What are value
6+
2. What is a variable
7+
3. what are datatypes
8+
4. what are 7 primitive datatypes
9+
5. 3 ways to Declare a variable in js - let,const,var
10+
6. console.log function
11+
7. Type of operator
12+
8. Whats Dynamic typing & its action
13+
9. Comments in JS
14+
10. What are statements and expressions in js
15+
11. What is a operator and a operand -> operator precendence
16+
12. Concatenation of string by + operator & template literals
17+
13. Multiline strings before ES6 and after ES6
18+
14. Conditional if-else statement
19+
15. Type conversion and type coercion in numbers , strings and boolean
20+
16. Equality operators (== vs ===)
21+
17. Inequality operators (!= vs !==)
22+
18. Switch statements in JS
23+
19. Conditional / terenary operator
24+
20. Loops in js - for,while loops
25+
21. How to embed loops & use loops to solve pattern questions
26+
22. What is an array datastructure
27+
23. Looping through an array
28+
24. What are objects
29+
25. creating complex objects - array of objects and object of arrays
30+
26. accessing the elements in an complex object using . (dot) and [""] (bracket) notations
31+
27. What are function and its anatomy
32+
28. Function declaration, function expression and arrow functions
33+
29. Function calling other functions
34+
30. Callback functions and how callbacks work
35+
31. Anonymous function
36+
32. Builtin-functions in string ->
37+
String: length, indexOf(), lastIndexOf(), slice(), substring(), replace(),split(), trim(), toUpperCase(), toLowerCase(), etc.
38+
33. Builtin-functions in string -> parseInt and parseFloat
39+
34. Builtin-functions in arrays ->
40+
Array: push(), pop(), shift(), unshift(), splice(), slice(),concat(), forEach(), map(), filter(), reduce(), find(), sort()
41+
35. What are classes and how to declare them
42+
36.

js_notes/basic-q.js

+135-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,140 @@ Convert temperature from Celsius to Fahrenheit and vice versa using appropriate
1919
2020
Mixed Topics:
2121
Write a program to find the factorial of a number using a loop.
22-
Create a simple calculator program that performs addition, subtraction, multiplication, and division based on user input*/
22+
Create a simple calculator program that performs addition, subtraction, multiplication, and division based on user input
23+
24+
Some extra advanced questions
25+
1.Implement a JavaScript program to print Fibonacci series using a for loop.
26+
*/
2327

2428
//Q1
29+
let num = 10;
30+
let str = "javascript";
31+
let bool = true;
32+
let arr = ["letters","numbers","datatypes"];
33+
let obj = {
34+
name:"indresh",
35+
status:"student",
36+
age:19,
37+
}
38+
console.log(num,str,bool,arr,obj);
39+
40+
41+
//Q2
42+
let number = 10;
43+
if(number%2==0){
44+
console.log("It is even")
45+
}
46+
else{
47+
console.log("it is odd")
48+
}
49+
50+
//Q3
51+
let score = 100;
52+
switch(true){
53+
case score<=50:
54+
console.log("F");
55+
break;
56+
case score<=60:
57+
console.log("E");
58+
break;
59+
case score <=70:
60+
console.log("D");
61+
break;
62+
case score <=80:
63+
console.log("C");
64+
break;
65+
case score <=90:
66+
console.log("B");
67+
break;
68+
case score <=100:
69+
console.log("A");
70+
break;
71+
default:
72+
console.log("not a valid mark");
73+
}
74+
75+
//Q4
76+
for(let i=1;i<=10;i++){
77+
console.log(i);
78+
}
79+
80+
//Q5
81+
let table = 5;
82+
for(let i=0;i<=10;i++){
83+
ans = table * i;
84+
console.log(`${table} * ${i} = ${ans}`);
85+
}
86+
87+
//Q6 - let l = 10 and w = 15 , exp output = 150
88+
function areaofRect(length,width){
89+
let area = length*width;
90+
console.log(area);
91+
}
92+
areaofRect(10,15);
93+
94+
//Q7 - cel to farenheit and farenheit to cel - logic
95+
//farenheit = 9/5 * cel + 32
96+
function FtoC(farenheit){
97+
let Celsius = 5/9 * (farenheit-32);
98+
console.log(`${farenheit} degree farenheit is equal to ${Celsius} degree celcius`)
99+
}
100+
101+
function CtoF(celcius){
102+
let farenheit = ((9/5)*celcius) + 32;
103+
console.log(`${celcius} degree celcius is equal to ${farenheit} degree farenheit`)
104+
}
105+
FtoC(212);
106+
CtoF(100);
107+
108+
//Q8 - factorial of a number using loops
109+
let factorialreq = 10;
110+
let factorialTerm = 1;
111+
for(let i=1;i<=factorialreq;i++){
112+
factorialTerm *= i;
113+
}
114+
console.log(factorialTerm);
115+
116+
//Q9 - simple calculator to perform + - * / based on user input
117+
let inputnum1 = 10;
118+
let inputnum2 = 20;
119+
let inputoperation = "division";
120+
function add(a,b){
121+
console.log(a+b);
122+
}
123+
function sub(a,b){
124+
console.log(a-b);
125+
}
126+
function mul(a,b){
127+
console.log(a*b);
128+
}
129+
function div(a,b){
130+
console.log(a/b);
131+
}
132+
133+
if(inputoperation == "addition"){
134+
add(inputnum1,inputnum2);
135+
}
136+
if(inputoperation == "substraction"){
137+
sub(inputnum1,inputnum2);
138+
}
139+
if(inputoperation == "multiplication"){
140+
mul(inputnum1,inputnum2);
141+
}
142+
if(inputoperation == "division"){
143+
div(inputnum1,inputnum2);
144+
}
145+
146+
//Q10 - fibonacci series using for loops
147+
//fibonacci series have a series of numbers and each number in the series is equivalent to the sum of the previous 2 numbers
148+
let fibonacciTermsreq = 10;
149+
let t1 = 0;
150+
let t2 = 1;
151+
console.log(t1);
152+
console.log(t2);
153+
for(let i=1;i <= fibonacciTermsreq;++i){
154+
t1 = t2;
155+
t2 = i;
156+
let nextterm = t1 + t2;
157+
console.log(nextterm);
158+
}

0 commit comments

Comments
 (0)