Closed bwanamaina closed 1 month ago
Woow, Nakwambia vitu naona hapa, I'm learning so much from you... kwani what JS do I writeπ but this is crazy because I had thought of doing exactly this(matching all the search terms with either the alias, bank name or branch name) but didn't know how I would go about the matching, even thinking on using the && logical operator after splitting the search term either by a whitespace or a comma, nikaona haimake sense...
Thank you for this!!!ππ
Bytha, out of curiosity, I've noticed you're not a big fan of arrow functions in JS, is there a reason why? Maybe the cons perhaps?
The JS you write is the international one π hakuna tofauti.
The first thought was to use comma separated search term in this format: kcb, ruiru
while this makes sense, typing ruiru, kcb
would end up confusing the logic... hio nikaweka kando π
About named/anonymous functions vs arrow functions, this is just a personal preference, I don't think there is any cons, but I find code written in arrow functions harder to read, especially the ones used without curly braces... unashindwa block imeanza wapi hadi wapi. For instance take a look at this two lines you can't easily tell where each ends π
If you type
kcb ruiru
orruiru kcb
order doesn't really matter it will returnall
banks withname
/alias
kcb and all banks withbranches
in ruiru.An ideal solution would be to have a separate filter/dropdown for the bank name and the search for any location where selected bank has a branch. This way the user can select the bank name and the location separately. This will make the search more accurate and user-friendly since we have a lot of records to filter.