Docsity

Salesforce JavaScript Developer Study Guide: Asynchronous JavaScript and DOM Manipulation, Exams of Advanced Education

Toggle sidebar
bg1
Salesforce Javascript Developer 1 study
guide complete update
A promise is - CORRECT ANSWER an object returned by asynchronous code
async/await syntax is syntactic sugar for - CORRECT ANSWER promises
the async keyword is added to the front of a - CORRECT ANSWER function that should contain
asynchronous code
the await keyword is added to the front of an asynchronous function call that returns - CORRECT
ANSWER a promise
the insertAfter() method can be used to add an element to the DOM after a given element (T/F) -
CORRECT ANSWER False. There is an insertBefore() method but no insertAfter() method.
A javascript object can be stored in a browser's localStorage using - CORRECT ANSWER JSON.stringify()
What are the additional reload options available via long click in Chrome? - CORRECT ANSWER -
Normal Reload
- Hard Reload
- Empty Cache and Hard Reload
DevTools must be open to access these options.
This method creates a table body - CORRECT ANSWER table.createTBody()
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Salesforce JavaScript Developer Study Guide: Asynchronous JavaScript and DOM Manipulation and more Exams Advanced Education in PDF only on Docsity!

Salesforce Javascript Developer 1 study

guide complete update

A promise is - CORRECT ANSWER an object returned by asynchronous code async/await syntax is syntactic sugar for - CORRECT ANSWER promises the async keyword is added to the front of a - CORRECT ANSWER function that should contain asynchronous code the await keyword is added to the front of an asynchronous function call that returns - CORRECT ANSWER a promise the insertAfter() method can be used to add an element to the DOM after a given element (T/F) - CORRECT ANSWER False. There is an insertBefore() method but no insertAfter() method. A javascript object can be stored in a browser's localStorage using - CORRECT ANSWER JSON.stringify() What are the additional reload options available via long click in Chrome? - CORRECT ANSWER - Normal Reload

  • Hard Reload
  • Empty Cache and Hard Reload DevTools must be open to access these options. This method creates a table body - CORRECT ANSWER table.createTBody()

This method inserts a table row - CORRECT ANSWER table.insertRow() What are two ways to listen for events in js? - CORRECT ANSWER - addEventListener()

  • an onevent handler (onclick, onmouseup, etc.) What are the two phases of event propagation in modern browsers? - CORRECT ANSWER - bubbling (goes from target to outermost ancestor)
  • capturing (goes from outermost ancestor to target) How is a custom event created and dispatched? - CORRECT ANSWER 1. CustomEvent() to create
  1. dispatchEvent() to dispatch ex: const myEvent = new customEvent( What objects can addEventListener() target? - CORRECT ANSWER Any object that supports events, including Element, Document, and Window What parameters can be passed to addEventListener()? - CORRECT ANSWER - an options object
  • useCapture (true or false) What are some benefits to using addEventListener()? - CORRECT ANSWER - can use multiple handlers for one event
  • allows controlling phase (bubbling/capturing) when activated

How can elements be retrieved by class or tag name? - CORRECT ANSWER - getElementsByClassName()

  • getElementsByTagName() What method can be used to create a DOM element? - CORRECT ANSWER document.createElement('tag name') What method can be used to add a child node to the end of the list of children of a parent node? - CORRECT ANSWER appendChild() What methods can get and set attributes of a DOM element? - CORRECT ANSWER - getAttribute()
  • setAttribute() What Chrome DevTools panel contains the Watch and Scope panes? - CORRECT ANSWER Sources Where in Chrome DevTools can the styles and classes applied to an element be edited? - CORRECT ANSWER Elements -> Styles What are the three parts of the Sources panel in Chrome DevTools? - CORRECT ANSWER - File Navigator
  • Code Editor
  • Javascript Debugging What browser API can be used to perform crud operations via server requests? - CORRECT ANSWER Fetch What browser APIs can be used to play audio and video? - CORRECT ANSWER Web Audio and WebRTC

What browser API can be used to get the device location? - CORRECT ANSWER Geolocation What browser API can be used to send notifications to the user? - CORRECT ANSWER Notifications What browser API can be used to store data client-side? - CORRECT ANSWER Web Storage What parameters does fetch() take? - CORRECT ANSWER - the path to the resource (required)

  • init, an object which can contain options such as:
    • method
    • headers
    • body
    • mode
    • credentials The fetch() method returns a ______ it can be called using these keywords: _____ - CORRECT ANSWER - promise
  • async / await The Geolocation API can be accessed through a call to - CORRECT ANSWER navigator.geolocation Location information can be accessed using - CORRECT ANSWER - Geolocation.getCurrentPosition() (current location)
  • Geolocation.watchPosition() (execute a function when the location changes) What parameters do Geolocation.getCurrentPosition() and Geolocation.watchPosition() accept? - CORRECT ANSWER - a success callback (required)
  1. set
  2. remove
  3. clear all keys from storage - CORRECT ANSWER 1. Storage.getItem()
  4. Storage.setItem()
  5. Storage.removeItem()
  6. Storage.clear() A cookie is set by - CORRECT ANSWER document.cookie = 'key=value;' Where can local storage, session storage and cookie data be viewed in the Chrome DevTools? - CORRECT ANSWER Application -> Storage Functions can't be nested in js (T/F) - CORRECT ANSWER False What is the difference in the value of the this keyword in traditional vs. arrow functions? - CORRECT ANSWER Traditional: the object that invoked the function, or else the global object Arrow: doesn't default to the global object. The value of this is determined by context A higher order function is - CORRECT ANSWER A function that takes a function as its inputs or creates a function as its output. What is hoisting? - CORRECT ANSWER Hoisting makes it so a function can be called before it is declared. This doesn't happen for function expressions. Closure allows code to - CORRECT ANSWER access its parent scope, even after that code has finished

Give an example of apply(), call() and bind() - CORRECT ANSWER How is a generator function declared? - CORRECT ANSWER function* funcName() {//code here yield value; } a decorator is - CORRECT ANSWER a wrapper function that extends an existing function A class can contain two constructors (T/F) - CORRECT ANSWER False A variable imported from a module can be updated outside of the module (T/F) - CORRECT ANSWER False (there could be functions from the module that update it) What method can be used to prevent an object's properties from being changed? - CORRECT ANSWER Object.freeze(obj) The arguments object of a function contains - CORRECT ANSWER all the values passed to the function in an array-like collection of values, and is only available for non-arrow functions How many parameters are passed to a decorator when it is used to decorate a class? - CORRECT ANSWER 1 Multiple decorators are allowed to be used in classes and class properties (T/F) - CORRECT ANSWER True, and the closest decorator is evaluated first How can a function be exported from a module so that it can be imported with any name? - CORRECT ANSWER export default function functionName()