Does lastName value get assigned to const _? I take it the _ is a convention for unused variables, seen it used before for arguments that are not referenced (I think)
22 years old, Computer Science student and currently Software Engineer at Netcetera. Passionate about technology, programming, specifically about deep learning, algorithms and applied maths.
Location
Skopje, Macedonia
Education
Faculty of Electrical Engineering and Information Technologies
Yup, it's mostly an unwritten rule adopted as a convention for variables that must be there but aren't going to be referenced anywhere. Similarly if you want to use .map() but only need the index, not the element itself for some weird reason:
constnewArr=arr.map((_,idx)=>{/* do something only with idx */});
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Does
lastName
value get assigned toconst _
? I take it the_
is a convention for unused variables, seen it used before for arguments that are not referenced (I think)Yup, it's mostly an unwritten rule adopted as a convention for variables that must be there but aren't going to be referenced anywhere. Similarly if you want to use
.map()
but only need the index, not the element itself for some weird reason: