HTML Compiler Online
Javascript Online Compiler
index.html
Change Theme
Compress code
Format code
Download Code
Clear Code
Copy Code!
RunĀ
ctrl+s or click
Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Article - JavaScript match string method 7</title> </head> <body> <h2>The <code>match()</code> method matches contents of a string using regular expression.</h2> <p>Press <kbd>F12</kbd> to open the console and see the output of the program.</p> <script> const str = "A random line with Infinity to Infinity and 100, NaN and null too."; console.log(str.match("random")); // ["random"] console.log(str.match(NaN)); // ["NaN"] console.log(str.match(Infinity)); // ["Infinity"] console.log(str.match(+Infinity)); // ["Infinity"] console.log(str.match(100)); // ["100"] console.log(str.match(+100)); // ["100"] console.log(str.match(null)); // ["null"] </script> </body> </html>
RunĀ