How to add type annotations - ANSWERSEx. interface OnClickHandler { (x:number, y:number): void; }
What tsc does - ANSWERS- envokes the TypeScript compiler
- converts to JavaScript
and formatting strings - ANSWERS('message');
The --strict flag - ANSWERS- typescript compiler flag
- "pleas...
Program Paradigms Exam 2 Questions &
Answers 100%
How to add type annotations - ANSWERSEx. interface OnClickHandler { (x:number,
y:number): void; }
What tsc does - ANSWERS- envokes the TypeScript compiler
- converts to JavaScript
console.log and formatting strings - ANSWERSconsole.log('message');
The --strict flag - ANSWERS- typescript compiler flag
- "please find my bugs"
var - ANSWERSfunction-level or global scope. This means they are accessible
throughout the entire function where they are declared or, if declared outside any
function, they become global variables accessible throughout the entire script.
const - ANSWERS- have block-level scope
- cannot be reassigned after their initial value is set.
let - ANSWERS- block-level scope
- are only accessible after the point in the code where they are declared.
Lists - ANSWERSare ordered collections of elements
Ex: const list = [1, 3, 5, 6, 7];
dictionaries - ANSWERScollections of key-value pairs, where each value is associated
with a unique key.
Ex. const dict = {"key" : "value"}
How to declare a function in typescript - ANSWERSEx:
let func = () => {}
Function reference in TS - ANSWERSEx: console.log(referenceFunction)
Callback function in TS - ANSWERSpassed as an argument in another function to be
called-after something is completed.
Ex. setTimeout(callBackFunction, 3000)
How to declare a function in python - ANSWERSEx:
def myFunc(p1:str, p2:str) -> None:
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Bestgrades2. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $10.99. You're not tied to anything after your purchase.