Skip to content

Instantly share code, notes, and snippets.

@vijayjangid
Last active May 31, 2021 10:26
Show Gist options
  • Save vijayjangid/b36ca96efd96eb7bf69686cf8fa8c38a to your computer and use it in GitHub Desktop.
Save vijayjangid/b36ca96efd96eb7bf69686cf8fa8c38a to your computer and use it in GitHub Desktop.
React Interview Questions

FOOD TRANSLATOR

Convert text into delicious Food emoji 😋

- Add an input control (input/textarea) to allow entering text.
- On text change, a food emoji should be rendered for each WORD in the text.
  - If the word length is ODD, print a PIZZA emoji 🍕
  - If the word length is EVEN, print a BURGER emoji 🍔
  - Each emoji should be separated by a <space>.

Example

input  : I love Pizza and Burger
output : 🍕 🍔 🍕 🍕 🍔

NOTE: you can copy the emojis and directly use in your HTML/JSX.

Bonus: add a button to randomly fetch sentence from below API and covert it into food emojis.

API: https://baconipsum.com/api/?type=meat-and-filler&sentences=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment