What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-24 09:55:05
javascript get cursor position without event
var Cursor_X; var Cursor_Y; document.addEventListener('mousemove', onMouseUpdate, false); document.addEventListener('mouseenter', onMouseUpdate, false); function onMouseUpdate(e){ Cursor_X = e.pageX; Cursor_Y = e.pageY; } Add solution -
Javascript 2022-03-22 03:40:37
javascript program for analog clock
const hourHand = document.querySelector('.hand-hour'); const minuteHand = document.querySelector('.hand-minute'); const secondHand = document.querySelector('.hand-seconds'); function getTime() { const now = new Date(); cons... Add solution -
Html 2022-03-21 23:25:41
how to use ml5.js
// Step 1: Create an image classifier with MobileNet const classifier = ml5.imageClassifier("MobileNet", onModelReady); // Step 2: select an image const img = document.querySelector("#myImage"); // Step 3: Make a prediction let predi... Add solution -
Javascript 2022-03-20 21:50:30
check if the element exists in javascript
var element = document.getElementById("test"); //If it isn't "undefined" and it isn't "null", then it exists. if(typeof(element) != 'undefined' && element != null){ alert('Element exists'); } else{ alert('Ele... Add solution -
Javascript 2022-03-19 10:15:11
string methods javascript count number of words inside a string
<html> <body> <script> function countWords(str) { str = str.replace(/(^\s*)|(\s*$)/gi,""); str = str.replace(/[ ]{2,}/gi," "); str = str.replace(/\n /,"\n"); return str.split(' ').length; }... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5