Skip to content

Nico JS Fundamentals#12

Open
nicopicchio wants to merge 7 commits intoboolean-uk:mainfrom
nicopicchio:main
Open

Nico JS Fundamentals#12
nicopicchio wants to merge 7 commits intoboolean-uk:mainfrom
nicopicchio:main

Conversation

@nicopicchio
Copy link

No description provided.


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

if (num >= lower && num <= upper) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be simplified to

return num >= lower && num <= upper

Copy link
Author

Choose a reason for hiding this comment

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

I have learnt about this just this morning, Definitely something I will try to implement in the next exercises


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

if (val1 === 'Hello' || val1 === 'Goodbye') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, the if statement isn't needed here. You can just return val1 === 'Hello' || val1 === 'Goodbye'


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

if (array.length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This can also be simplified


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

if (num1 > num2) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above :)


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

return Math.min(...nums)
Copy link
Contributor

@Auenc Auenc Dec 17, 2021

Choose a reason for hiding this comment

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

Great use of the Math library, and the array spread syntax!

function isHello(val1) {
// TODO: write code in this function body to pass the tests

if (val1 === "Hello") {
Copy link
Contributor

Choose a reason for hiding this comment

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

This can also be simplified

function isNotHello(val1) {
// TODO: write code in this function body to pass the tests

if (val1 !== "Hello") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above :)

function isLongerThan(val1, val2) {
// TODO: write code in this function body to pass the tests

if (val1.length > val2.length) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This can also be simplified

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