loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.8651289592176967","path":"main.js","file":{"path":"main.js","content":{"asEncoding":{"base64":"Ly8gRGF0YSBkZWZpbml0aW9uCnZhciBwcmltZU51bWJlcnMgPSBbMiwzLDUsNywxMV07CnZhciBqc0ZyYW1ld29yayA9IHsnbmFtZSc6J1JlYWN0JywnY3JlYXRvcic6J0ZhY2Vib29rJywncHVycG9zZSc6J1VJcyd9CgovLyBPcHRpb24gMSBFUzUgZm9yRWFjaCBvbiBhcnJheQp2YXIgbG9vcFN0YXJ0T3B0MSA9IHBlcmZvcm1hbmNlLm5vdygpOwpwcmltZU51bWJlcnMuZm9yRWFjaChmdW5jdGlvbiAodmFsdWUpIHsKICBjb25zb2xlLmxvZyh2YWx1ZSk7Cn0pOwpjb25zb2xlLmxvZyhwZXJmb3JtYW5jZS5ub3coKSAtIGxvb3BTdGFydE9wdDEgKyAnIG1zJykKCi8vIE9wdGlvbiAyIEVTNSBmb3JFYWNoIG9uIE9iamVjdAp2YXIgbG9vcFN0YXJ0T3B0MiA9IHBlcmZvcm1hbmNlLm5vdygpOwpPYmplY3Qua2V5cyhqc0ZyYW1ld29yaykuZm9yRWFjaChmdW5jdGlvbihwcm9wZXJ0eSl7CiAgICBjb25zb2xlLmxvZyhwcm9wZXJ0eSsnIDogJytqc0ZyYW1ld29ya1twcm9wZXJ0eV0pOwp9KTsKY29uc29sZS5sb2cocGVyZm9ybWFuY2Uubm93KCkgLSBsb29wU3RhcnRPcHQyICsgJyBtcycpCgoKLy8gVGVzdCBmdW5jdGlvbnMgYW5kIGRhdGEgZm9yIG90aGVyIEVTNSBpdGVyYXRpb24gbWV0aG9kcwpmdW5jdGlvbiBpc1ByaW1lKGVsZW1lbnQsIGluZGV4LCBhcnJheSkgeyAKICByZXR1cm4gZWxlbWVudCAvIDE7IAp9IApmdW5jdGlvbiBldmVuTnVtYmVyKGVsZW1lbnQsaW5kZXgsYXJyYXkpIHsgCiAgaW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er":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Data definition
var primeNumbers = [2,3,5,7,11];
var jsFramework = {'name':'React','creator':'Facebook','purpose':'UIs'}

// Option 1 ES5 forEach on array
var loopStartOpt1 = performance.now();
primeNumbers.forEach(function (value) {
  console.log(value);
});
console.log(performance.now() - loopStartOpt1 + ' ms')

// Option 2 ES5 forEach on Object
var loopStartOpt2 = performance.now();
Object.keys(jsFramework).forEach(function(property){
    console.log(property+' : '+jsFramework[property]);
});
console.log(performance.now() - loopStartOpt2 + ' ms')


// Test functions and data for other ES5 iteration methods
function isPrime(element, index, array) { 
  return element / 1; 
} 
function evenNumber(element,index,array) { 
  if (element % 2 === 0)
    return element;
}
function allCaps(str) {
    return str.toUpperCase()
}
var pageHits = ['home.html', 'react.html', 'home.html', 'angular.html', 'home.html','nodejs.html','react.html'];

function countPageHits(allPages, page) { 
  if (page in allPages) {
    allPages[page]++;
  }
  else {
    allPages[page] = 1;
  }
  return allPages;
}

//Other ES5 iteration method samples
console.log(primeNumbers.every(isPrime));//True
console.log(primeNumbers.every(evenNumber));//False
console.log(primeNumbers.filter(evenNumber));//[2]
console.log(primeNumbers.some(evenNumber));//True
console.log(Object.keys(jsFramework).map(allCaps));//[ 'NAME', 'CREATOR', 'PURPOSE' ]
console.log(pageHits.reduce(countPageHits,{}));
console.log(pageHits.reduceRight(countPageHits,{}));
Native Browser JavaScript