Typescript and Angular Flashcards
What is the general structure of an HTML document and what are the different parts of the document used for?
The Html document is divided into several parts, these are head part and body part. In the head part there is a <title> tag that we use to give a title for the page and it is visible on the web browser url. And also, we can add css styling in the head part. The body part is where we design the structure of the webpage by using different tags.</title>
What are some HTML elements you’ve used?
Some elements that I used are <div>, <p>, <ul> <section> , <h1> and more
What are inline and block elements?
Inline elements are those which do not start a new line and take up to the width of the content of the element
While block elements are those which start on a new line and take a full width of the available space. Moreover, we can have inline block elements inside the block elements, but we cannot have block elements inside inline elements
What is the purpose of assigning ID’s and Classes to elements?
The purpose of assigning id’s and classes to elements is that they will use for the purpose of styling and for Js functions. For example, we can select elements by their id and implement styling for that specific id content or we can add interaction for that specific element in JS by selecting the element by its id.
How do I create an ordered list or an unordered list?
We can create ordered list by using <ol> tag and we can also create an unordered list by using <ul> tag. For both lists we can use <li> tag to display the lists
What new features were introduced in HTML5?
Vector Graphics, Audio and video, preload videos, regular expressions, nav tag, email attribute.
How can I attach Javascript to an HTML file?
We can attach Js to html using the
tag. We can either embed Javascript direcly into the HTML inside script tag: ``.const js = “Javascript code”`, or more likely link to an external file containing our js source using the “src” attribute: `<script src=jscode.js>
What is CSS?
Cascading style sheet; determines how a given element is presented on a webpage; gives more control over the appearance of a webpage to the creator
What are the three different ways to apply CSS to HTML elements? Which one takes priority?
Inline (Highest Priority): Applied directly to an HTML element using the “style” attribute.
Internal: Internal styles are defined within the head section of an HTML document.
External: External styles are defined in a separate CSS file and linked to your HTML document.
What are the different ways we could select HTML elements for applying styling rules? How are they prioritized?
Element Selectors
Class Selectors
ID Selectors
Attribute Selectors
What is the CSS box model?
CSS box model is a container that has(contains) multiple properties like borders, margin, padding, and the content. It is used to create the layout of webpages.
Content: displays text, images
Padding: creates space around the elements
Border: surrounds the content and padding it can be styled with color and width
Margin: create space around the border.
What is responsive web design?
RWD (Responsive Web Design) is the development of a website that responds to accommodate to different screen sizes and orientations. To achieve this we need to implement flexible layouts, media queries and flexible media.
Could you provide a short description of Javascript?
JavaScript is a dynamic and loosely typed programming language. It is used for web development, it allow us to implement dynamic features on web pages. Also runs on a single thread with an event loop handling events
What does it mean for Javascript to be loosely typed?
Loose typing means that no type checking of data fields is performed, which can lead to errors/undefined behavior when a certain type is expected, but data of another type is received. For example, if you expect two numbers but you get strings and then divide them by each other.
What does it mean for Javascript to be interpreted?
Javascript does not need to be compiled to be run. It is immediately run by the browser without any conversion into another language.
What are the types in Javascript?
The primitive types are:
Null – A singleton set representing a null value
Undefined – A singleton set representing an undefined value
Boolean – A binary state consisting of either true or false
Number - Equivalent to a double in java, i.e. 64-bit IEEE 754 floating point.
BigInt – An integer (whole number) value having arbitrary size/precision. Unlike in java where an int is of size 4 (32 bits).
String – A sequence of UTF-16 encoded characters. Practically identical to Java String.
Symbol – A guaranteed unique key value used for Objects.
Plus programmer defined Objects.
What is type coercion in Javascript?
The conversion of values from one data type to another (such as strings to numbers).
What are truthy and falsy values in Javascript?
Truth values are values that evaluate to true in context of a boolean.
Example of falsy values:
false
0
-0
“”
null
undefined
NaN
What is the difference between == and === in Javascript?
Tripple equals “===” checks for strict equality, so will return false if the operands are of different types. This is unlike double equals “==” which will attempt to coerce the operands to compare them.
What are the different ways to declare a variable in Javascript?
let – Declares a variable following normal block scoping rules.
var – Like let, except scope is global; not confined to it’s defining block. – hoisted to the top of the file
const – Immutable: cannot change value or be redefined. Similar to let in scoping rules.
What are callback functions in Javascript?
Is a function that is passed as an argument to another function, and it is called after the main function has finished its execution.
What is the DOM?
Document Object Model is the representation of the HTML document in memory. its generated and can be manipulated by web API’s to change the look of the page as it is being viewed. When a web page is loaded the browser will load a DOM for that page and it allows Js and other programing languages to access and manipulate the content of the page.
How can I select & modify HTML elements in Javascript?
document.getElementById, document.querySelector(), document.querySelectorAll(), document.getElementByClassName().
How can I have Javascript execute some function when a button is clicked?
Use an event listener on that variable on two different ways. I can use button.onclick() or cutton.addEventListener (“click”, functionname()).
What is an EventListener and why is it used?
It is a build in function in JS that allows us to wait for user interaction to then run some code. We normally use it on buttons, inputs, or when a user types or clicks on the screen so we could then do something.
What is bubbling & capturing?
Bubbling happens when an element receives and event, and that event is propagated to its parent and ancestor elements in the DOM. Capturing is when the event is first captured by the outermost element, then propagates to the inner elements
What is the event loop in Javascript?
Responsible for executing the code, collecting and processing events, and executing queued sub-tasks
What are Promises, what are they used for?
A promise is the object that represents the eventual completion or failure of an asynchronous process and its result
What do Async & Await do in Javascript?
Async and await are tags you can use on methods and processes inside methods to let it know that it’s an asynchronous operation and enables promise-based behavior in a cleaner style