Skip to content

Js Fundamentals#17

Open
JasonKundi wants to merge 11 commits intoboolean-uk:mainfrom
JasonKundi:main
Open

Js Fundamentals#17
JasonKundi wants to merge 11 commits intoboolean-uk:mainfrom
JasonKundi:main

Conversation

@JasonKundi
Copy link

No description provided.


// TODO: write code in this function body to pass the tests
if (num >= lower && num <= upper) {
return true
Copy link

@phillipdunn phillipdunn Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified num >= lower && num <= upper as it will resolve to either a true or false value. Try:

return num >= lower && num <= upper

function isHelloOrGoodbye (val1) {

// TODO: write code in this function body to pass the tests
if (val1 === 'Hello' || val1 === 'Goodbye') {
Copy link

@phillipdunn phillipdunn Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above and seen in other files too, have a look through:

return val1 === 'Hello' || val1 === 'Goodbye'

count++
}
}
if (count%2 !== 0) {
Copy link

@phillipdunn phillipdunn Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as a lot of the if statements throughout, you can just return the boolean:

return count%2 !== 0


// TODO: write code in this function body to pass the tests

if (array.length === 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as others, just return the boolean


// TODO: write code in this function body to pass the tests

if (num1 > num2) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as others, just return the boolean


// TODO: write code in this function body to pass the tests

if (val1 === 'Hello') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as others, just return the boolean


// TODO: write code in this function body to pass the tests
if (val1 !== 'Hello') {
return true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as others, just return the boolean

// TODO: write code in this function body to pass the tests

if (val1.length > val2.length) {
return true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as others, just return the boolean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants