JSFiddle - React, Tailwind, and code Playground

by ponyspy

HTML

<div class="cool"></div>
<div class="cool"></div>
<div class="cool"></div>
<div class="cool"></div>
<div class="cool"></div>

<div class="zlo">1</div>

JavaScript

var one = $('<div>', {'text': '1111'})
var two = $('<div>', {'text': '2222', class: 'cool'})
var three = $('<div>', {'text': '2222'})
var four = $('<div>', {'text': '2222'})


var arr = $([one, two, three, four]).map($.fn.toArray);

arr.toArray().some(function(item) {
  
  return arr.filter(item).hasClass('cool')
  	? $(item).text('zlo')
    : false;
    
}) || $('.zlo').text('none');

$('.zlo').append(arr)