Converting string to symbol


#1

I just don't understand this exercise.

These are the instructions:
Create a new variable, symbols, and store an empty array in it.
Use .each to iterate over the strings array.
For each s in strings, use .tosym to convert s to a symbol and use .push to add that new symbol to symbols._
Check the Hint for a refresher on .each and .push.

It seems to become a pattern now that I find it hard to understand the instructions. What I understand so far is that each time there is an 's' in one of the words (for instance CSS), that word should be changed to a symbol (i.e. a unique code, since only one copy of any symbol exists at a given time). I can't seem to solve it though. My screenshot is completely wrong, but I still attached it.

Could also someone tell me how this code would apply on website? Is it for example to validate an email inserted by a user, that must contain a specific word/url prefix? Could someone then explain to me the point/logic in making it a symbol?


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.