JSFiddle - React, Tailwind, and code Playground
by Ahmad Asjad
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div class="one">
+
+++
+
</div>
<div class="two">
+ + ++++ + ++ + + +
+ ++ +++ + +++ ++ + +++
+ ++ + + ++ + + + + ++
</div>
JavaScript
jQuery().ready(function(){
var lines = $(".two").text().split("\n");
for(i=1;i<=lines[1].length;i++){
if(lines[1][i]=='+'
&& lines[2][i-1]!='undefined' && lines[1][i]==lines[2][i-1]
&& lines[2][i]!='undefined' && lines[1][i]==lines[2][i]
&& lines[2][i+1]!='undefined' && lines[1][i]==lines[2][i+1]
&& lines[3][i]!='undefined' && lines[1][i]==lines[3][i]
){
console.log('exists');
}
}
});