parent
00c9da92bb
commit
a52476c497
@ -0,0 +1,14 @@
|
||||
export default Countries = [
|
||||
'Albania',
|
||||
'Bolivia',
|
||||
'Canada',
|
||||
'Denmark',
|
||||
'Ethiopia',
|
||||
'Finland',
|
||||
'Germany',
|
||||
'Hungary',
|
||||
'Ireland',
|
||||
'Japan',
|
||||
'Kenya'
|
||||
]
|
||||
|
@ -0,0 +1,73 @@
|
||||
// 1.question
|
||||
let emt = [];
|
||||
// 2.question
|
||||
let five = [1, 2, 3, 4, 5];
|
||||
// 3.question
|
||||
console.log(five.length);
|
||||
// 4.question
|
||||
let f = 0, l = five.length - 1, mid = (f + l) / 2;
|
||||
console.log(five[f], five[l], five[mid]);
|
||||
// 5.question
|
||||
let mixedDataTypes = [
|
||||
1,
|
||||
'satya',
|
||||
false,
|
||||
20,
|
||||
null
|
||||
];
|
||||
// 6.question
|
||||
let itCompanies = [
|
||||
'Facebook',
|
||||
'Google',
|
||||
'Microsoft',
|
||||
'Apple',
|
||||
'IBM',
|
||||
'Oracle',
|
||||
'Amazon'
|
||||
];
|
||||
// 7.question
|
||||
console.log(itCompanies);
|
||||
// 8.question
|
||||
console.log(itCompanies.length);
|
||||
// 9.question
|
||||
l = itCompanies.length - 1;
|
||||
console.log(itCompanies[f], itCompanies[l], itCompanies[mid]);
|
||||
// 10.question
|
||||
itCompanies.forEach((company) => console.log(company));
|
||||
// 11.question
|
||||
itCompanies.forEach((company) => console.log(company.toUpperCase()));
|
||||
// 12.question
|
||||
console.log(itCompanies.toString());
|
||||
// 13.question
|
||||
(itCompanies.includes('Facebook')) ? console.log(itCompanies[itCompanies.indexOf('Facebook')]) : console.log('Not found');;
|
||||
// 14.question
|
||||
// itCompanies.map((c) => {
|
||||
// let count = 0;
|
||||
// let i = c.split(',');
|
||||
// i.map((e) => {
|
||||
// console.log(e);
|
||||
// if (e.split(',') == 'o') { count++; }
|
||||
// })
|
||||
// if (count > 1) {
|
||||
// // console.log(c);
|
||||
// }
|
||||
// // console.log(c);
|
||||
// });
|
||||
// 15.question
|
||||
itCompanies.sort();
|
||||
// 16.question
|
||||
itCompanies.reverse();
|
||||
// 17.question
|
||||
itCompanies.slice(0, 2);
|
||||
// 18.question
|
||||
itCompanies.slice(l - 4, l - 1);
|
||||
// 19.question
|
||||
itCompanies.slice(mid, mid + 1);
|
||||
// 20.question
|
||||
itCompanies.shift();
|
||||
// 21.question
|
||||
itCompanies.splice(mid, 1, 0);
|
||||
// 22.question
|
||||
itCompanies.pop();
|
||||
// 23.question
|
||||
itCompanies.slice(0);
|
@ -0,0 +1,3 @@
|
||||
import web_techs from "./web_techs";
|
||||
|
||||
console.log(web_techs);
|
@ -0,0 +1 @@
|
||||
console.log(i)
|
@ -0,0 +1,9 @@
|
||||
export default [
|
||||
'HTML',
|
||||
'CSS',
|
||||
'JavaScript',
|
||||
'React',
|
||||
'Redux',
|
||||
'Node',
|
||||
'MongoDB'
|
||||
]
|
@ -0,0 +1,71 @@
|
||||
// 1.question
|
||||
function fullName() {
|
||||
console.log(`Satya surendra`);
|
||||
}
|
||||
fullName();
|
||||
// 2.question
|
||||
function fullName(fullName,lastName) {
|
||||
return fullName + ' ' + lastName;
|
||||
}
|
||||
console.log(fullName('satya', 'surendra'));
|
||||
|
||||
// 3.question
|
||||
function addNumbers(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
console.log(addNumbers(1, 2));
|
||||
// 4.question
|
||||
function areaOfRectangle(l,b) {
|
||||
return l * b;
|
||||
}
|
||||
// 5.question
|
||||
function perimeterOfRectangle(l, b) {
|
||||
return 2(l + b);
|
||||
}
|
||||
// 6.question
|
||||
function volumeOfRectPrism(l, b, h) {
|
||||
return l * b * h;
|
||||
}
|
||||
// 7.question
|
||||
function areaOfCircle(r) {
|
||||
return 3.14 * r * r;
|
||||
}
|
||||
// 8.question
|
||||
function circumOfCircle(r) {
|
||||
return 2 * 3.14 * r;
|
||||
}
|
||||
// 9.question
|
||||
function density(mass, volume) {
|
||||
return mass / volume;
|
||||
}
|
||||
// 10.question
|
||||
function speed(d, t) {
|
||||
return d / t;
|
||||
}
|
||||
// 11.question
|
||||
function weight(mass,gravity) {
|
||||
return mass * gravity;
|
||||
}
|
||||
// 12.question
|
||||
function convertCelsiusToFahrenheit(c) {
|
||||
return (c * 9 / 5) + 32;
|
||||
}
|
||||
// 13.question
|
||||
function IBM(weight, height) {
|
||||
let ibm = weight / Math.pow(height, 2);
|
||||
if (ibm < 18.5) {
|
||||
console.log('Underweight');
|
||||
} else if (ibm >= 18.5 && ibm < 24.9) {
|
||||
console.log('Normal weight');
|
||||
} else if (ibm >= 25 && ibm < 29.9) {
|
||||
console.log('Overweight');
|
||||
} else {
|
||||
console.log(`Obese`);
|
||||
}
|
||||
}
|
||||
// 14.question
|
||||
|
||||
// 15.question
|
||||
function findMax(a, b, c) {
|
||||
return Math.max(a, b, c);
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
// 1.question
|
||||
function solveLinEquation(a, b, c) {
|
||||
return -a / b;
|
||||
}
|
||||
// 2.question
|
||||
// function solveQuadratic(a,b,c) {
|
||||
// return Math.sqrt(-b + 4 * a * c) / 2*a;
|
||||
// }
|
||||
// // console.log(solveQuadratic()) // {0}
|
||||
// console.log(solveQuadratic(1, 4, 4)) // {-2}
|
||||
// console.log(solveQuadratic(1, -1, -2)) // {2, -1}
|
||||
// console.log(solveQuadratic(1, 7, 12)) // {-3, -4}
|
||||
// console.log(solveQuadratic(1, 0, -4)) //{2, -2}
|
||||
// console.log(solveQuadratic(1, -1, 0)) //{1, 0}
|
||||
// 3.question
|
||||
function printArray(arr) {
|
||||
for (let i = 0; i < arr.length; i++){
|
||||
console.log(arr[i]);
|
||||
}
|
||||
}
|
||||
printArray([1, 2, 3, 4, 5]);
|
||||
// 4.question
|
||||
function showDateTime() {
|
||||
let now = new Date();
|
||||
let day = now.getDate(),
|
||||
mon = now.getMonth(),
|
||||
year = now.getFullYear(),
|
||||
hrs = now.getHours(),
|
||||
min = now.getMinutes();
|
||||
console.log(`${day}/${mon}/${year} ${hrs}:${min}`);
|
||||
}
|
||||
// 5.question
|
||||
function swap(a, b) {
|
||||
let t;
|
||||
t = a;
|
||||
a = b;
|
||||
b = t;
|
||||
console.log(a,b);
|
||||
}
|
||||
swap(1, 2)
|
||||
// 6.question
|
||||
function reverseArray(arr) {
|
||||
let rev = [];
|
||||
for (let i = arr.length; i >= 0; i--){
|
||||
rev.push(arr[i]);
|
||||
}
|
||||
return rev;
|
||||
}
|
||||
// 7.question
|
@ -0,0 +1 @@
|
||||
solveQuadratic
|
Loading…
Reference in new issue