SHARE
TWEET

Untitled

a guest Jun 26th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict';
  2.  
  3. function Matrix (data) {
  4.   this.data = data
  5. }
  6. Matrix.process = function () {
  7.   return Math.random() > 1 ? {data: "some_data"} : NaN;
  8. }
  9.  
  10. function f() {
  11.     var matrix = new Matrix(), processedVal;
  12.     Object.freeze(matrix)
  13.     for ( var i in matrix.data ) {
  14.         for ( var j in matrix.data ) {
  15.             processedVal = await matrix.process()
  16.         }
  17.     }
  18.     if ( processedVal === {data: "some_data"} ) {
  19.         return 1
  20.     } else if ( processedVal === NaN ) {
  21.         return 2
  22.     }
  23.  
  24.     delete matrix.data;
  25.    
  26.     var res = await Promise.race([fetch('/api/1'), fetch('/api/2']);
  27.     var json = res.json()
  28.    
  29.     if ( json.some.data === processedVal ) {
  30.         setTimeout(() => {
  31.             return 3
  32.         }, 1000)
  33.     }
  34.    
  35.     try {
  36.         return 4
  37.     } finally {
  38.         return 5
  39.     }
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top