DEV Community

ZhiHong Chua
ZhiHong Chua

Posted on • Edited on

Frontend Fundamentals 10/20

1. JSON.Stringify

Quite alright now

2. Autocomplete

a) System Architecture

  • React View Component
  • Controller - Cache
  • Server

b) API Design

  • input: String, output: Array

c) Consider Requirements

  • debounce? QPS allowed on BE?
  • how often do you want to refresh data?
  • offline error
  • global? Local? Localised content?

d) Code / Test

  • limit to 10 results. Too many choice can be confusing UX
  • Debounce duration to test with UAT and Designers for optimal UX. 300 - 500ms perhaps.
  • search string put as the cache key, case insensitive.
  • cache on localstorage, or indexedDB if possible, since search space is large.
  • abstract able component, might use this component on other pages.
  • offline error perhaps a bar at top of the page in red, showing the error. The search can show loading ui, and poll every second for the answer.

e) Optimise

  • accessibility short keys
  • button click size

3. System Design in General

Reading this UI guide, seems that everything is quite clear. The only thing that's abit obtuse is accessibility.

They recommended a course here but let's revisit that it we have time.

  • this page actually has a list of interesting possible questions and areas to focus on

4 & 5. Leetcode JS Questions

Doing some of these, I think Leetcode constrains the problems very well compared to GreatFrontEnd. The latter challenges us to consider more data-types (strings, number, null, object, array), while Leetcode is very definitive. GFE also helps in trying to understand this and prototypical inheritance of the sorts, or like extending a prototype to have new functions. Leetcode just create a typical JS function, which is way easier to do.

This func.apply vs func.call vs () => {} still gets me. I guess I should study abit and then apply it to some questions tomorrow.

This StackOverflow post seems to summarise it nicely. In essence, anything that needs to use this or arguments cannot use arrow functions. And another article on bind

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more