doc: modernize and fix code examples in readline.md
Checklist
-
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
doc, readline
- Improve UX in 2 code examples (add spaces between output and input for better readability).
- Replace
indexOf()
bystartsWith()
.