Created
May 28, 2018 00:26
-
-
Save dmastag/ddfc30ca80720e29ae3da25b67b4b670 to your computer and use it in GitHub Desktop.
// source http://jsbin.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
"use strict"; | |
var dataAwal = "kukuku cupu-cupu"; | |
var yangDiganti = "u"; | |
var regexp = new RegExp(yangDiganti, "g"); | |
var digantiJadi = "o"; | |
var hasil = dataAwal.replace(regexp, digantiJadi); | |
console.log(dataAwal); | |
console.log(hasil); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">const dataAwal = "kukuku cupu-cupu"; | |
const yangDiganti = "u"; | |
const regexp = new RegExp(yangDiganti, "g"); | |
const digantiJadi = "o"; | |
const hasil = dataAwal.replace(regexp,digantiJadi); | |
console.log(dataAwal) | |
console.log(hasil) | |
</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var dataAwal = "kukuku cupu-cupu"; | |
var yangDiganti = "u"; | |
var regexp = new RegExp(yangDiganti, "g"); | |
var digantiJadi = "o"; | |
var hasil = dataAwal.replace(regexp, digantiJadi); | |
console.log(dataAwal); | |
console.log(hasil); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment