Post History
Javascript (V8), 202 97 bytes o=>r=>o.replace(/[a-zA-Z]/g,o=>String.fromCharCode((o<="Z"?90:122)>=(o=o.charCodeAt()+r)?o:o-26)) Try it online! Since the text of input must be ma...
Answer
#5: Post edited
# [Javascript (V8)](https://v8.dev/), 202 bytes- ```js
function rot(o,r){return o.replace(/[a-zA-Z]/g,function(o){return String.fromCharCode((o<="Z"?90:122)>=(o=o.charCodeAt(0)+r)?o:o-26)})}(function update(){const o=rot("Hello World",4);console.log(o)})();- ```
[Try it online!](https://tio.run/##Pc7NCoJAFIbhWxFX55BaSUR/FtGmfYugaDGMoxnTfHIaWxReuxVU6/ddPBd1VzctVe3j@6TrisZpX8EFAk@IhJ9ifCMuQCKmtkob6h9V/FjHh1O/jH474T/uvFSuTArBdXNWskFuiLDIwkO4mg5mwzTlZUbIkOhvXnsacE94hRnidMwtt/R3NHWuvCF@aribD5B9YOHWWItgD7F5GI14/omwJrEo35SWiedd9wI)Since the text of input must be manually changed from the code, here is how to change it, Go to `const o=rot("Hello World",4);` and change the text between `""` (string) to something like `const o=rot("Codidact Code Golf",4);` or anything you like then run. also you can change ROT$n$ by changing number 4 in `const o=rot("Hello World",4);` to anything you like `const o=rot("Hello World",13);`.
- # [Javascript (V8)](https://v8.dev/), <strike>202</strike> 97 bytes
- ```js
- o=>r=>o.replace(/[a-zA-Z]/g,o=>String.fromCharCode((o<="Z"?90:122)>=(o=o.charCodeAt()+r)?o:o-26))
- ```
- [Try it online!](https://tio.run/##Lc2xDoIwEADQX2k63UUpSoxRtBDC4u5ggnFoSkVM5cjRMPjzlcH5De9tZjNZ7seQzIfoXRBMQWgRSResC1LsRm@sg/Rukm@VNI@0Wy92DdwPnXoyfeqX4ZpaB0BnLRtZHjf5Nsuw0ECalP1zFQBXjCXllGR7xGhpmMg75amDJQV5cd6TuBH7ViLsEE/xBw)
- Since the text of input must be manually changed from the code, here is how to change it, Go to `console.log(rot("Hello World")(4));` and change text between `""` (String) into anything you want lke `console.log(rot("Codidact Code Golf)(4));` and if you want to change ROT$n$, change the number between brackets into anything like `console.log(rot("Codidact Code Golf)(13));`.
#4: Post edited
- # [Javascript (V8)](https://v8.dev/), 202 bytes
- ```js
- function rot(o,r){return o.replace(/[a-zA-Z]/g,function(o){return String.fromCharCode((o<="Z"?90:122)>=(o=o.charCodeAt(0)+r)?o:o-26)})}(function update(){const o=rot("Hello World",4);console.log(o)})();
- ```
- [Try it online!](https://tio.run/##Pc7NCoJAFIbhWxFX55BaSUR/FtGmfYugaDGMoxnTfHIaWxReuxVU6/ddPBd1VzctVe3j@6TrisZpX8EFAk@IhJ9ifCMuQCKmtkob6h9V/FjHh1O/jH474T/uvFSuTArBdXNWskFuiLDIwkO4mg5mwzTlZUbIkOhvXnsacE94hRnidMwtt/R3NHWuvCF@aribD5B9YOHWWItgD7F5GI14/omwJrEo35SWiedd9wI)
Since the text of input must be manually changed from the code, here is how to change it, Go to `const o=rot("Hello World",4);` and change the text between `""` to something like `const o=rot("Codidact Code Golf",4);` or anything you like then run.
- # [Javascript (V8)](https://v8.dev/), 202 bytes
- ```js
- function rot(o,r){return o.replace(/[a-zA-Z]/g,function(o){return String.fromCharCode((o<="Z"?90:122)>=(o=o.charCodeAt(0)+r)?o:o-26)})}(function update(){const o=rot("Hello World",4);console.log(o)})();
- ```
- [Try it online!](https://tio.run/##Pc7NCoJAFIbhWxFX55BaSUR/FtGmfYugaDGMoxnTfHIaWxReuxVU6/ddPBd1VzctVe3j@6TrisZpX8EFAk@IhJ9ifCMuQCKmtkob6h9V/FjHh1O/jH474T/uvFSuTArBdXNWskFuiLDIwkO4mg5mwzTlZUbIkOhvXnsacE94hRnidMwtt/R3NHWuvCF@aribD5B9YOHWWItgD7F5GI14/omwJrEo35SWiedd9wI)
- Since the text of input must be manually changed from the code, here is how to change it, Go to `const o=rot("Hello World",4);` and change the text between `""` (string) to something like `const o=rot("Codidact Code Golf",4);` or anything you like then run. also you can change ROT$n$ by changing number 4 in `const o=rot("Hello World",4);` to anything you like `const o=rot("Hello World",13);`.
#3: Post edited
- # [Javascript (V8)](https://v8.dev/), 202 bytes
- ```js
- function rot(o,r){return o.replace(/[a-zA-Z]/g,function(o){return String.fromCharCode((o<="Z"?90:122)>=(o=o.charCodeAt(0)+r)?o:o-26)})}(function update(){const o=rot("Hello World",4);console.log(o)})();
- ```
- [Try it online!](https://tio.run/##Pc7NCoJAFIbhWxFX55BaSUR/FtGmfYugaDGMoxnTfHIaWxReuxVU6/ddPBd1VzctVe3j@6TrisZpX8EFAk@IhJ9ifCMuQCKmtkob6h9V/FjHh1O/jH474T/uvFSuTArBdXNWskFuiLDIwkO4mg5mwzTlZUbIkOhvXnsacE94hRnidMwtt/R3NHWuvCF@aribD5B9YOHWWItgD7F5GI14/omwJrEo35SWiedd9wI)
Since the text of input must be manually changed from the code, here is how to change it, Go to `const o=rot("Hello World",4);` and change the text between `""` to something like `const o=rot("Codidacr Code Golf",4);` or anything you like then run.
- # [Javascript (V8)](https://v8.dev/), 202 bytes
- ```js
- function rot(o,r){return o.replace(/[a-zA-Z]/g,function(o){return String.fromCharCode((o<="Z"?90:122)>=(o=o.charCodeAt(0)+r)?o:o-26)})}(function update(){const o=rot("Hello World",4);console.log(o)})();
- ```
- [Try it online!](https://tio.run/##Pc7NCoJAFIbhWxFX55BaSUR/FtGmfYugaDGMoxnTfHIaWxReuxVU6/ddPBd1VzctVe3j@6TrisZpX8EFAk@IhJ9ifCMuQCKmtkob6h9V/FjHh1O/jH474T/uvFSuTArBdXNWskFuiLDIwkO4mg5mwzTlZUbIkOhvXnsacE94hRnidMwtt/R3NHWuvCF@aribD5B9YOHWWItgD7F5GI14/omwJrEo35SWiedd9wI)
- Since the text of input must be manually changed from the code, here is how to change it, Go to `const o=rot("Hello World",4);` and change the text between `""` to something like `const o=rot("Codidact Code Golf",4);` or anything you like then run.
#2: Post edited
# [Javascript V8](https://v8.dev/), 202 bytes- ```js
- function rot(o,r){return o.replace(/[a-zA-Z]/g,function(o){return String.fromCharCode((o<="Z"?90:122)>=(o=o.charCodeAt(0)+r)?o:o-26)})}(function update(){const o=rot("Hello World",4);console.log(o)})();
- ```
[Try it online!](https://tio.run/##Pc7NCoJAFIbhWxFX55BaSUR/FtGmfYugaDGMoxnTfHIaWxReuxVU6/ddPBd1VzctVe3j@6TrisZpX8EFAk@IhJ9ifCMuQCKmtkob6h9V/FjHh1O/jH474T/uvFSuTArBdXNWskFuiLDIwkO4mg5mwzTlZUbIkOhvXnsacE94hRnidMwtt/R3NHWuvCF@aribD5B9YOHWWItgD7F5GI14/omwJrEo35SWiedd9wI)
- # [Javascript (V8)](https://v8.dev/), 202 bytes
- ```js
- function rot(o,r){return o.replace(/[a-zA-Z]/g,function(o){return String.fromCharCode((o<="Z"?90:122)>=(o=o.charCodeAt(0)+r)?o:o-26)})}(function update(){const o=rot("Hello World",4);console.log(o)})();
- ```
- [Try it online!](https://tio.run/##Pc7NCoJAFIbhWxFX55BaSUR/FtGmfYugaDGMoxnTfHIaWxReuxVU6/ddPBd1VzctVe3j@6TrisZpX8EFAk@IhJ9ifCMuQCKmtkob6h9V/FjHh1O/jH474T/uvFSuTArBdXNWskFuiLDIwkO4mg5mwzTlZUbIkOhvXnsacE94hRnidMwtt/R3NHWuvCF@aribD5B9YOHWWItgD7F5GI14/omwJrEo35SWiedd9wI)
- Since the text of input must be manually changed from the code, here is how to change it, Go to `const o=rot("Hello World",4);` and change the text between `""` to something like `const o=rot("Codidacr Code Golf",4);` or anything you like then run.
#1: Initial revision
# [Javascript V8](https://v8.dev/), 202 bytes ```js function rot(o,r){return o.replace(/[a-zA-Z]/g,function(o){return String.fromCharCode((o<="Z"?90:122)>=(o=o.charCodeAt(0)+r)?o:o-26)})}(function update(){const o=rot("Hello World",4);console.log(o)})(); ``` [Try it online!](https://tio.run/##Pc7NCoJAFIbhWxFX55BaSUR/FtGmfYugaDGMoxnTfHIaWxReuxVU6/ddPBd1VzctVe3j@6TrisZpX8EFAk@IhJ9ifCMuQCKmtkob6h9V/FjHh1O/jH474T/uvFSuTArBdXNWskFuiLDIwkO4mg5mwzTlZUbIkOhvXnsacE94hRnidMwtt/R3NHWuvCF@aribD5B9YOHWWItgD7F5GI14/omwJrEo35SWiedd9wI)