Tampilkan postingan dengan label javascript. Tampilkan semua postingan

String DataType

// reverse()
String.prototype.reverse = function(){
  return this.toString().split('').reverse().join('');
}

// Without default javascript function
String.prototype.reverse = function(){
  var self = this.toString();
  var result = "";
  for(i=self.length-1;i>=0;i--){
  	result+=self[i];
  }
  return result;
}
// Test
console.log("Hello World!".reverse());
// output: !dlroW olleH


//

Array DataType

// toObject()
//

Object DataType

// 
//

Date DataType

// toLocale(),toString(), format(type)
//

Time DataType

// toDate(format="Y-m-d H:i:s")
//

Coming soon

//
//

ReactJS Templates

npx create-react-app my-app --template cra-template            # default
npx create-react-app my-app --template cra-template-typescript # typescript
npx create-react-app my-app --template cra-template-pwa        # add serviceWorker

More info search for cra-template-*.


ReactJS Modules

npm i express                # express http server
# const express = require("express");
# const app = express();

npm i bootstrap              # add bootstrap
# import "bootstrap/dist/css/bootstrap.min.css";

Separate string by character length

"This is String".replace(/(.{4})/,"$1\n")
Result:
This
 is 
Stri
ng