Time: 10 pm.
Initially gone through the chrome developer tools such as console, network(seeing different types of API requests), debugging through breakpoints, elements, source. I haven’t got enough motivation to go through all the other components of its developer enviroment but got basic idea.
After supper break:-
Time: 12:05 am :- Working out few free code camp challenges:-
Comparision with the strict equality operator:-
strict equality operator is some what different than the equality operator. It check on both the data type and value on the element of both sides (===). For example:-
1 === 1 is true and 1 === “1” is false. you might have already understood the difference. first example on both sides was number data type and same values and where as on the other side it was number data type on one side and string data type on the other side. In equality operator, it normally converts the data type and does the comparision.
challenge:- Use the strict equality operator in the if
statement so the function will return “Equal” when val
is strictly equal to 7.
// Setup
function testStrict(val) {
if (val === 7) { // Change this line
return "Equal";
}
return "Not Equal";
}
// Change this value to test
testStrict(7);
Comparision with inequality operator :-
Inequality operator(!=) also converts the datatype as equality operator
but the semantics are different.
challenge:- Add the inequality operator !=
in the if
statement so that the
function will return “Not Equal” when val
is not equivalent to 99.
// Setup
function testNotEqual(val) {
if (val != 99) { // Change this line
return "Not Equal";
}
return "Equal";
}
// Change this value to test
testNotEqual(10);
Comparision with the Strict Inequality Operator :-
It doesn’t convert the data types.
challenge:-Add the strict inequality operator
to the if
statement so the function will return “Not Equal” when val
is not strictly equal to 17
function testStrictNotEqual(val) {
if (val !== 17) {
return "Not Equal";
}
return "Equal";
}
testStrictNotEqual(12);
Comparision with greater than operator:-
Like equality operator, greater than operator converts the data type.
challenge:-Add the greater than
operator to the indicated lines so that the return statements make sense.
function testGreaterThan(val) {
if (val > 100) { // Change this line
return "Over 100";
}
if (val > 10) { // Change this line
return "Over 10";
}
return "10 or Under";
}
// Change this value to test
testGreaterThan(100);
Comparison with the Greater Than or Equal to Operator :-
Like the greater than operator, this operator also converts the data type
while comparing.
challenge:-Add the greater than or equal to
operator to the indicated lines so that the return statements make sense
function testGreaterOrEqual(val) {
if (val >= 20) { // Change this line
return "20 or Over";
}
if (val >= 10) { // Change this line
return "10 or Over";
}
return "9 or Under";
}
// Change this value to test
testGreaterOrEqual(10);
Comparison with the Less Than Operator :-
Likewise the greater than operator, greater than equal operator, this operator also converts the data type while comparing.
challenge:- Add the less than
operator to the indicated lines so that the return statements make sense.
function testLessThan(val) {
if (val < 25) { // Change this line
return "Under 25";
}
if (val < 55) { // Change this line
return "Under 55";
}
return "55 or Over";
}
// Change this value to test
testLessThan(10);
Comparison with the less than or equal to operator :-
this operator also converts the data type while comparison.
challenge:- Add the less than or equal to
operator to the indicated lines so that the return statements make sense.
function testLessOrEqual(val) {
if (val <= 12) { // Change this line
return "Smaller Than or Equal to 12";
}
if (val <= 24) { // Change this line
return "Smaller Than or Equal to 24";
}
return "25 or More";
}
// Change this value to test
testLessOrEqual(10);
Comparison with logical AND operator :-
this operator returns “true” if operands on both sies are true. This effect could be achieved
by nesting an if statement inside another if:
if (num > 5) {
if (num < 10 ) {
return "Yes";
}
}
return "No";
using the above login with AND Operator.
if (num > 5 && num < 10) {
return "Yes";
}
return "No";
challenge:- Combine the two if statements into one statement which will return "Yes"
if val
is less than or equal to 50
and greater than or equal to 25
. Otherwise, will return"No"
.
function testLogicalAnd(val) {
// Only change code below this line
if (val <= 50 && val >= 25) {
return "Yes";
}
// Only change code above this line
return "No";
}
// Change this value to test
testLogicalAnd(10);