We help IT Professionals succeed at work.

What language is this code snippet?

Hi, I'm documenting a change in a web page (not written by my company)and encountered the following snippet. What language is it? JavaScript? Thanks.

(function() { function forEach(responses, cb) { Object.keys(responses).forEach(function(adUnitCode) { var response = responses[adUnitCode]; response.bids.forEach(function(bid) { cb(adUnitCode, bid); }); }); } var winners = pbjs.getAllWinningBids(); var output = []; forEach(pbjs.getBidResponses(), function(code, bid) { output.push({ bid: bid, adunit: code, adId: bid.adId, bidder: bid.bidder, time: bid.timeToRespond, cpm: bid.cpm, msg: bid.statusMessage, rendered: !!winners.find(function(winner) { return winner.adId==bid.adId; }) }); }); forEach(pbjs.getNoBids && pbjs.getNoBids() || {}, function(code, bid) { output.push({ msg: "no bid", adunit: code, adId: bid.bidId, bidder: bid.bidder }); }); if (output.length) { if (console.table) { console.table(output); } else { for (var j = 0; j < output.length; j++) { console.log(output[j]); } } } else { console.warn('NO prebid responses'); } })(); 

Open in new window

Comment
Watch Question

David FavorFractional CTO
Distinguished Expert 2019

Commented:
Looks like Javascript.
Sam JacobsCitrix Technology Professional / Director of TechDev Services, IPM

Commented:
Yes, that is JavaScript.
Information Architect
Top Expert 2006
Commented:
Stephen KairysTechnical Writer - Consultant

Author

Commented:
Thanks, everyone!
Stephen KairysTechnical Writer - Consultant

Author

Commented:
Follow-up: Is the below also Javascript:

<script src = "https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/creative.js"></script>
<script>
  var ucTagData = {};
  ucTagData.adServerDomain = "";
  ucTagData.pubUrl = "%%PATTERN:url%%";
  ucTagData.targetingMap = %%PATTERN:TARGETINGMAP%%;

  try {
    ucTag.renderAd(document, ucTagData);
  } catch (e) {
    console.log(e);
  }
</script>

Open in new window

Zakaria AcharkiAnalyst Developer
Distinguished Expert 2018

Commented:
Yes, javascript too, I would suggest to you two websites helps you to identify the programming language of the given code :

This website gives you logical results :

https://creativetechguy.com/utilityprograms/codedetector

This algorithm requires a quick sing up but gives the best result :

https://algorithmia.com/algorithms/PetiteProgrammer/ProgrammingLanguageIdentification