Complete the code to create a Promise that resolves with 'Hello'.
const greeting = new Promise((resolve, reject) => { resolve([1]); });The Promise resolves with the string 'Hello', so it must be in quotes.
Complete the code to subscribe to an Observable and log its emitted value.
observable$.subscribe(value => { console.log([1]); });The callback receives the emitted value as 'value', which we want to log.
Fix the error in the Promise usage to handle the resolved value.
promise.then([1] => console.log('Done:', [1]));
The then method expects a function; use an arrow function with a parameter to receive the resolved value.
Fill both blanks to create an Observable that emits numbers 1 to 3 and completes.
const numbers$ = new Observable(observer => { observer.[1](1); observer.[1](2); observer.[1](3); observer.[2](); });Use observer.next() to emit values and observer.complete() to signal completion.
Fill all three blanks to convert a Promise to an Observable and subscribe to it.
const promise = new Promise(resolve => resolve([3])); const obs$ = from([1]); obs$.[2](value => console.log(value));
Use from(promise) to create an Observable from a Promise, then subscribe to it, and create a Promise resolving to a string.