FE Interview Prep Takeaways Flashcards
What is currying in JavaScript?
Currying is a technique in JavaScript and other functional programming languages where a function, instead of taking multiple arguments at once, takes a single argument and returns a new function that takes the next argument. This process continues until all arguments have been provided, at which point the final value is computed.
What is partial application in JavaScript?
Partial application refers to the process of fixing a few arguments of a function and generating a new function with a reduced number of arguments. Unlike currying, which is a way to apply functions one argument at a time, partial application allows you to set any combination of a function’s arguments, not just the ones in a specific order.
What should you set when submitting a form in HTML to specify where and how to send the data?
When submitting a form in HTML, it’s important to specify:
- Action Attribute (action): This sets the URL where the form data will be sent when the user submits the form. If omitted, the form data will be sent to the URL of the page containing the form.
-
Method Attribute (method): This sets the HTTP method used when sending form data. The most commonly used methods are
GET
andPOST
. For secure or large data, it’s advisable to usePOST
.
Why should you avoid nesting <input>
elements inside of <label>
elements in HTML?
Avoid nesting <input>
elements inside of <label>
elements because some assistive technologies, such as Dragon NaturallySpeaking, do not support this structure well. This can result in accessibility issues for users who rely on such technologies to navigate and interact with web content.
What is the for...of loop
in JavaScript and how is it used?
The for...of
loop is a modern iteration statement in JavaScript that allows you to iterate over the values of iterable objects like arrays, strings, maps, and sets.
for (const element of iterable) { // code block to be executed }
How do you fix the width discrepancy between textarea
and input
elements in CSS?
To make textarea
and input
elements have the same width, you can use the box-sizing: border-box;
CSS property on the input
element.
How do you write a media query in CSS?
A media query in CSS allows you to apply styles based on certain conditions such as screen width, device orientation, and more.
@media (condition) {} @media (max-width: 600px) {}