How to name it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 4

How to name it

Solved i made function which make array from pseudo-array. For example: var obj={0: "a", 1: "b", length: 2, text: "hello"}, then f(obj)==["a","b"] this can be used in cycle: for(var i=0; i<obj.length; i++) = for(var i in f(obj)) Make short name for this function f() please

2nd Apr 2022, 11:09 AM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
24 Answers
+ 1
typeSort()
2nd Apr 2022, 7:47 PM
HungryTradie
HungryTradie - avatar
+ 1
"f"
2nd Apr 2022, 11:26 AM
Simon Sauter
Simon Sauter - avatar
+ 1
"function_that_does_things"
2nd Apr 2022, 11:37 AM
Simon Sauter
Simon Sauter - avatar
+ 1
You wrote the function, you know what it does, you know what to associate with it. Give it any name you feel comfortable with. If you want to name it "f" then do that. Don't over-think it, you can still change it later if necessary.
2nd Apr 2022, 11:38 AM
Lisa
Lisa - avatar
+ 1
Okay i go play brawl stars
2nd Apr 2022, 11:44 AM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
+ 1
You're thinking too much about it, it's just a function. :) You don't need to write a full sentence, just the most essential part: numObj2arr, numeric object parts to array. You can still re-name it later.
2nd Apr 2022, 11:46 AM
Lisa
Lisa - avatar
+ 1
HungryTradie thanks for explanations
3rd Apr 2022, 6:14 AM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
+ 1
K.S. Nandhu i understand
3rd Apr 2022, 6:15 AM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
0
2nd Apr 2022, 11:33 AM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
0
I need normal name :/
2nd Apr 2022, 11:34 AM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
0
"f" is a perfectly normal name for a function.
2nd Apr 2022, 11:35 AM
Simon Sauter
Simon Sauter - avatar
0
normal name must be associated with things which function does. "f" associated with nothing
2nd Apr 2022, 11:36 AM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
0
Simon Sauter it is only worse because longer
2nd Apr 2022, 11:38 AM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
0
Well if longer is worse, then what better name than "f"? "i"?
2nd Apr 2022, 11:39 AM
Simon Sauter
Simon Sauter - avatar
0
I know what it does, i can name it "make_array_of_object_properties_which_have_numeric_name" but it is to long
2nd Apr 2022, 11:40 AM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
0
"maoopwhnn"
2nd Apr 2022, 11:41 AM
Simon Sauter
Simon Sauter - avatar
0
I understand, gonna try to use something likt that
2nd Apr 2022, 11:47 AM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
0
Ti loh i bot yobaniy, idi nahui
2nd Apr 2022, 12:37 PM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
0
HungryTradie ok, normal
2nd Apr 2022, 7:48 PM
Ashas Yiksvorogom
Ashas Yiksvorogom - avatar
0
We should not use any special character except underscore for identifiers Syntax of for loop is for<variable>in<sequence>: We can add range() except sequence But in this syntax error
3rd Apr 2022, 5:53 AM
K.S. Nandhu