JSFiddle - React, Tailwind, and code Playground
by ccnokes
HTML
<p>
jQuery is a multi-browser JavaScript library designed to simplify the client-side scripting of HTML. It was released in January 2006 at BarCamp NYC by John Resig. It is currently developed by a team of developers led by Dave Methvin. Used by over 55% of the 10,000 most visited websites, jQuery is the most popular JavaScript library in use today.
</p>
CSS
body {margin:0; padding:15px; font-family:sans-serif;}
p {display:none;}
JavaScript
//Get first five words of text node
function getWords(string){
return string.split(/\s+/).slice(1,5).join(" ");
}
//provide string for getWords function
var str = $('p').text();
//write to DOM
$('<h2>' + getWords(str) + '</h2>').appendTo('body');