how to write random quote machien

Solutions on MaxInterview for how to write random quote machien by the best coders in the world

showing results for - "how to write random quote machien"
Joya
05 Nov 2020
1const getQuote = data => {
2  // 1) here we are creating the callback function that we will pass to the JSONP request
3  const callbackName = 'displayQuote'
4  window[callbackName] = function(data) {
5    delete window[callbackName]
6    document.body.removeChild(script)
7    callback(data)
8  }
9
10  // 2) we are injecting the script tag into our HTML
11  const script = document.createElement('script')
12  script.src =
13    url + (url.indexOf('?') >= 0 ? '&' : '?') + 'callback=' + callbackName
14  document.body.appendChild(script)
15}