JavaScript by Tomar Ravi;Dangi Sarishma;
Author:Tomar, Ravi;Dangi, Sarishma; [Tomar, Ravi]
Language: eng
Format: epub
Tags: COMPUTERS/Programming/Games, COMPUTERS/Programming/General, COMPUTERS/Programming Languages/General, COMPUTERS/Programming Languages/JavaScript, COMPUTERS/Web/General, COMPUTERS/Web/Site Design, COMPUTERS/Web/Web Programming
Publisher: CRC Press LLC
Published: 2022-11-15T00:00:00+00:00
5.10.3.3 Code Snippet-3
// Create reference to button.
const btn = document.querySelector(".btn");
// Creating a reference to input box.
const myInput = document.querySelector("#thought");
// Create a reference to where result is to be displayed.
const resultHere = document.querySelector(".result p");
btn.addEventListener("click", () => {
const processPrompt = document.createElement("p");
processPrompt.innerHTML = "Doing this nowâ¦";
processPrompt.style.color = "red";
var content =
"Splitting a string (your lyrics) into array of string-chunks, based on a delimiter (white-space)";
var comment = document.createElement("p");
comment.innerHTML = content;
resultHere.appendChild(processPrompt);
resultHere.appendChild(comment);
const lyrics = myInput.value;
// Splitting the lyrics into separate words.
const chunks = lyrics.split(" ");
// Convert array into string, for displaying purpose.
const result = document.createElement("p");
result.innerHTML = `[ ${chunks.toString()}]`;
// Display result.
resultHere.appendChild(result);
});
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Exploring Deepfakes by Bryan Lyon and Matt Tora(7753)
Robo-Advisor with Python by Aki Ranin(7651)
Offensive Shellcode from Scratch by Rishalin Pillay(6118)
Microsoft 365 and SharePoint Online Cookbook by Gaurav Mahajan Sudeep Ghatak Nate Chamberlain Scott Brewster(5054)
Ego Is the Enemy by Ryan Holiday(4960)
Management Strategies for the Cloud Revolution: How Cloud Computing Is Transforming Business and Why You Can't Afford to Be Left Behind by Charles Babcock(4440)
Python for ArcGIS Pro by Silas Toms Bill Parker(4193)
Elevating React Web Development with Gatsby by Samuel Larsen-Disney(3902)
Machine Learning at Scale with H2O by Gregory Keys | David Whiting(3640)
Learning C# by Developing Games with Unity 2021 by Harrison Ferrone(3286)
Speed Up Your Python with Rust by Maxwell Flitton(3232)
Liar's Poker by Michael Lewis(3228)
OPNsense Beginner to Professional by Julio Cesar Bueno de Camargo(3195)
Extreme DAX by Michiel Rozema & Henk Vlootman(3176)
Agile Security Operations by Hinne Hettema(3125)
Linux Command Line and Shell Scripting Techniques by Vedran Dakic and Jasmin Redzepagic(3110)
Essential Cryptography for JavaScript Developers by Alessandro Segala(3083)
Cryptography Algorithms by Massimo Bertaccini(3002)
AI-Powered Commerce by Andy Pandharikar & Frederik Bussler(2985)
