- how do you implement concurrency in javascript?
a - they've to explain single threaded javascript, browser or node environment, and only then the event loop
- why do html forms auto-submit and reroute?
a - ajax only came later, this was the only way before
- different ways of fetching or posting data
xhr
img or src tags, since they're all HTTP request, technically you can send data via GET request params
jsonp
- can a script on one tab access another tabs dom, or if open an iframe and open a banking website, can I send requests or access cookies?
a - SOP, and then follow up questions on SOP. also, http cookies.
- what is under and what isn't under SOP?
a - storage, cookies, scripts and xhr fall under sop. while other resources such as imgs etc don't.
- CORS
a - explain how CORS is set, and why there's still a problem with it i.e request will still be sent, response can't be read. hence can be exploited.
- if i try to fire 10 xhr requests at once, what happens?
a - browsers have a concurrency limit based on the tcp protocol i.e http1, http2 etc. ideally, you should chunk it to 5 requests.
- why the need for IIFE?
a - before es6, only way of emulating block scope
- explain closures and why?
a - indepth explanation of execution context, lexical environments. and for loop creating new block for each iteration with let.
- is ecma script specifies something, how is it implementeed?
a - it's upto the js engine to decide how it'll implement a feature. es only specifies behaviour, not internal implementation.
- protoype based OOP
a - explain oop in terms of prototypes vs class.
- explain the dynamic nature of javascript
a - prototype based, can append properties to objects even after creation, functions are also objects, run time types, allows for reassignment etc
- why is javascript like this? why prototype based model, why dynamic?
a - originally, it was just a scripting language and not meant to be a full blown programming langugage.
- explain cascading, inheritance and specificty in CSS
a - high level explanation of cascading and specificty algorithm for style resolution, and different origins of css i.e user-agent stylesheet, user, author etc
- explain viewport, and logical px in css
a -
preferred answer would be meta tag introduced by apple and then virtual resolutions
- if i load a viedo with video tag, and run an infinite loop in js main thread, the site is stuck, but how does video still play?
a - browser offloads media playback to seperate threads. only interactions with video etc are handled by js
- from an application perspective, how is mobile and web dev different?
a - intuitive answer includes mobile apps being an entire package i.e default SPAs, single entry point and different routing paradigm, and data fetching, initial global data everything handled differently from web.
- explain SPAs, and different rendering strategies in modern web dev
a - SSR, CSR, SSG etc
- can i store a huge image file in a data url?
a - differnt types of urls, paths, data url and url character limit