Skip to content

Commit 41bce17

Browse files
author
harshini
committed
files added.
2 parents 6aa2ce0 + 15e2a37 commit 41bce17

12 files changed

Lines changed: 207 additions & 0 deletions

BMICalculator.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
function bmiCalculator (weight, height) {
2+
var BMI=weight/(height*height);
3+
var interpretation;
4+
if(BMI<18.5)
5+
{
6+
interpretation="Your BMI is "+BMI+ ", so you are underweight.";
7+
}
8+
else if(BMI>=18.5 && BMI<=24.9)
9+
{
10+
interpretation="Your BMI is "+BMI+ ", so you have a normal weight.";
11+
}
12+
else
13+
{
14+
interpretation="Your BMI is "+BMI+ ", so you are overweight.";
15+
16+
}
17+
return interpretation;
18+
}
19+
bmiCalculator(67,1.89);

Comparators.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var n="1";
2+
var num=1;
3+
if(n == num)
4+
{
5+
alert("I will compare the content , but neglecting the data type");
6+
}
7+
else
8+
{
9+
alert("Well I will [(a === b)] compare the datatype , but neglecting the content");
10+
}
11+
/*There are other equalities and comparators like :
12+
!== -->Strictly not equals, compares the datatypes and content
13+
=== -->Strictly equals compares if both are having same datatype and also content
14+
&&
15+
||
16+
>
17+
!= -->compares the content only irrespective of datatype
18+
== --> "
19+
<
20+
>=
21+
<=
22+
*/

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
<<<<<<< HEAD
12
Completed Challenges in JavaScript.
3+
=======
4+
# javaScript
5+
Learning New Tech-js
6+
>>>>>>> 15e2a3739786944ea938dc303d0a8cf0023ed928

RandomNumberGenerator.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var nameOfYours=prompt("Enter your Name:");
2+
var nameOfYourPartner=prompt("Enter your Partner's Name:");
3+
var randomNumber=Math.random();//generates random number b/w 0-0.999999999999999999999
4+
randomNumber=Math.floor(randomNumber*100);//to calculate on %, it goes upto 100
5+
randomNumber=randomNumber+1;//it also includes 0,to eliminate that +1
6+
// console.log(n);
7+
if(randomNumber >=70){
8+
alert("Your Love Score is "+randomNumber+"%"+"You both are made for each other");
9+
}
10+
else
11+
{
12+
alert("Your Love Score is "+randomNumber+"%");
13+
}

case.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// harshini
2+
var name=prompt("Enter your Name:");
3+
var x=name.slice(0,1);
4+
alert(x.toUpperCase(name)+name.slice(1,name.length));

converter.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//dogAge to humanAge Convertor
2+
var dogAge=prompt("What is Dog Age?");
3+
var humanAge=(dogAge-2)*4+21;
4+
alert("Your dog is"+" "+humanAge+" "+"years old in human years.");

countCharacters.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var message=prompt("Compose your message:");
2+
var len=message.length;
3+
alert("you have written "+" "+ len +" "+"characters and you have left with"+" "+(280-len)+" "+"characters");

fibonaciiSeries.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
var output=[];
2+
function fibonaciiSeries(n)
3+
{
4+
if(n === 1)
5+
{
6+
return [0];
7+
}
8+
else if(n === 2)
9+
{
10+
return [0,1];
11+
}
12+
else
13+
{
14+
output=[0,1];
15+
for(var i=2;i<n;i++)
16+
{
17+
output.push(output[i-2]+output[i-1]);
18+
}
19+
}
20+
return output;
21+
}
22+
fibonaciiSeries(6);
23+
//output:[0, 1, 1, 2, 3, 5]

fizzBuzz.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
function add(number) {
2+
3+
for(var i=0;i<=100;i++)
4+
{
5+
//number++;
6+
7+
8+
if(number%3===0 && number%5 ===0)
9+
{
10+
console.log("FIZZBUZZ");
11+
//number++;
12+
continue;
13+
}
14+
if(number%3===0)
15+
{
16+
console.log("Fizz");
17+
//number++;
18+
continue;
19+
}
20+
if(number%5===0)
21+
{
22+
console.log("Buzz");
23+
continue;
24+
//number++;
25+
}
26+
number++;
27+
console.log(number);
28+
29+
}
30+
alert(number);
31+
32+
}
33+
add(1);
34+
35+
////////---------->other possibility <--------------\\\\\\\\\\\\\\\\\\
36+
var output = [];
37+
var count = 1;
38+
function replaceCounts() {
39+
40+
if (count % 3 === 0 && count % 5 === 0) {
41+
output.push("FIZZBUZZ");
42+
43+
} else if (count % 3 === 0) {
44+
output.push("FIZZ");
45+
} else if (count % 5 === 0) {
46+
output.push("BUZZ");
47+
} else {
48+
output.push(count);
49+
}
50+
count++;
51+
console.log(output);
52+
}

leapYear.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
function isLeap(year) {
2+
3+
/**************Don't change the code above****************/
4+
5+
//Write your code here.
6+
if(year%4 === 0 && year%400 === 0)
7+
{
8+
console.log("Leap year.");
9+
}
10+
else if(year%100 === 0 && year%400 !== 0)
11+
{
12+
console.log("Not leap year.");
13+
}
14+
else
15+
{
16+
console.log("Not leap year.");
17+
}
18+
19+
/**************Don't change the code below****************/
20+
21+
}
22+
isLeap(1900);

0 commit comments

Comments
 (0)