Assessment wanted for Functions tasks

Hello! Need assessment for Functions skill tests.

Codepen:
Task 1.
Task 2.
Task 3.
Task 4.

Sometimes I used arrow functions with only one string in statements and { } because otherwise strings in code redactor are too long. Is it ok? Or write something like this is normal for code style too?

Task two is a little bit upgraded.

duprya den @VladimirK

i do not know the code style convention for js but for me since i use java i use it’s convention everywhere

for me i do not make the line too long so the line should be full displayed on the screen i guess it 80 character and most IDE has built in option to rearrange your code to make it even follow the convention and code style for the language you use

and for your answer you doing great and nice upgrade for task 2 but for task 3 the multi use of => make your code unredeable and hard to get

the task want you to create generic random() function that take 2 boundery upper and lower then return a value in that range and then you use the resturn value to use in the choosename funtion to get certain array element then use that value to set the para element

i use arrow function only when i do not need to reuse it again so in java term we call it anonymous like when you use to do the filter in task 4 but use it every where would make code harder to read and it go harder when you keep get the return of one to be the parameter of another one
but that just me and i could be wrong

hope that help and have a nice day :slight_smile:

2 Likes

Hello, @justsomeone! Thanks for the feedback.

Upadated task 3. Seems like arrow functions in comments looks good.

I try to google and realized that the question about cases when we can use arrow funсtion instead of ordinary function() { } is not documented. I think it depends on the rules in a specific project or company and particular cases like using this or something else. And i agree with you about unredeable and hard to get code.

you welcome @VladimirK

it would be better to change this
return array[random(3, 5)];

to return array[random(0, array.length)];

to make it more generic to any array :wink:

and have a nice day :slight_smile:

1 Like

check those videos

it has some tips for write a clean code forget about the language and focus on the concept
by the way the IDE the video mention you can use the ultimate version of it for html/css/js for free if you used the EAP version (beta version)

hope that help and have a nice day :slight_smile:

1 Like

Thank you for coming back with the stuff! I will study it.

you very welcome @VladimirK

1 Like