🌐
Miniclass Web
  • Miniclass Web
  • 1. Pengenalan Pemrograman Web
    • Cara Kerja Website
    • Pengenalan Backend dan Frontend
    • HTTP Request dan HTTP Response
  • 2. HTML
    • Pengenalan HTML
    • Text Formatting
    • Link
    • Media
    • List
    • Table
    • Form
    • Grouping
  • 3. CSS
    • Pengenalan CSS
    • Selector CSS
    • Text Formatting
    • Background
    • Border
    • Height dan Width
    • Spacing
    • Layouting
    • Responsive Design
    • Membuat Template Web Responsive
  • 4. Javascript
    • Pengenalan JavaScript
    • Javascript for Java developer
    • Array
    • Fungsi
    • Manipulasi DOM
    • Event
    • Fetch API
    • Object JavaScript
    • UI Component Lanjutan
  • 5. Node.js
    • Pengenalan Node.js
    • Membuat Server HTTP
    • Routing
    • Import Export
    • Node Package Manager
    • Nodemon
  • 6. Express.js
    • Pengenalan Express.js
    • HTTP Method
    • Menerima Data dari URL
    • Middleware
    • Menerima Data dari Body
    • Mengunggah File
    • Menampilkan File dalam Folder
    • Menyimpan Data ke Database MySQL
  • 7. Modern Frontend Development
    • ECMAScript
    • Transpiler
    • Module Bundler
  • 8. React Fundamental
    • Pengenalan React JS
    • Props
    • Event
    • State
    • Conditional Rendering
    • Component Mapping
    • Side Effect
    • Custom Hook
  • 9. React State Management
    • Lifting State Up
    • Context
    • Reducer
  • 10. React Performance
    • Debounce
    • Throttling
    • Memoization
    • Profiling
  • 11. React Testing
    • Component Testing
    • Hook Testing
    • Mocking
    • End to End Testing
  • 12. Object Relational Mapping
    • Pengenalan Object Relational Mapping
  • 13. Document Oriented Database
    • Document Oriented Database
    • Object Document Mapping
  • 14. Web Service
    • REST
    • GraphQL
  • 15. Autentikasi
    • JSON Web Token
    • Membuat Web Service Sederhana
  • 16. Microservices
    • Microservices
    • Microservices Gateway
    • Message Queue
    • Remote Procedure Call
    • Membuat Micro Service Sederhana
  • 18. Caching
Powered by GitBook
On this page
  • Comments
  • Semicolon
  • Arithmetic Operator
  • Precedence
  • Infinity
  • Boolean
  • String & Char
  • Negation
  • Equality
  • Comparison
  • String Concatenation (and more)
  • Truthy / Falsy
  • Variables
  • Shorthand
  • Array / List
  • Object
  • Control Structure
  • Function / Method

Was this helpful?

  1. 4. Javascript

Javascript for Java developer

Comments

Java
Javascript

Semicolon

Java
Javascript

Arithmetic Operator

Java
Javascript

Semua angka di Javascript disimpan sebagai 64-bit IEEE 754 double, sedangkan Java memiliki int, float, dan double.

Precedence

Java
Javascript

Infinity

Java
Javascript

Boolean

Java
Javascript

String & Char

Java
Javascript

Negation

Java
Javascript

Equality

Java
Javascript

Comparison

Java
Javascript

String Concatenation (and more)

Java
Javascript

Truthy / Falsy

Java
Javascript

Variables

Java
Javascript

Shorthand

Java
Javascript

Array / List

Java
Javascript

Object

Java
Javascript

Control Structure

Java
Javascript

Function / Method

Java
Javascript

PreviousPengenalan JavaScriptNextArray

Last updated 2 years ago

Was this helpful?

// single line comments
/* multi
   line comments */
/**
 * Docstring
 * @params {String} a - blablabla
 */
// single line comments
/* multi
   line comments */
/**
 * Docstring
 * @params {string} a - blablabla
 */
someStatement(); // with semicolon
someStatement() // without semicolon, error
someStatement(); // with semicolon
someStatement() // without semicolon, ok
1 + 1; // = 2
0.1 + 0.2; // = 0.30000000000000004
8 - 1 // = 7
10 * 2; // = 20
35 / 5; // = 7
5 / 2; // = 2
5f / 2f; // = 2.5f
5.0 / 2.0; // = 2.5
10 % 2; // = 0
30 % 4; // = 2
1 + 1; // = 2
0.1 + 0.2; // = 0.30000000000000004
8 - 1 // = 7
10 * 2; // = 20
35 / 5; // = 7
5 / 2; // = 2.5
5.0 / 2.0; // = 2.5
10 % 2; // = 0
30 % 4; // = 2
(1 + 3) * 2; // = 8
2 + (2 - 1) * 8 // = 10
(1 + 3) * 2; // = 8
2 + (2 - 1) * 8 // = 10
Double.POSITIVE_INFINITY
Double.NEGATIVE_INFINITY
Infinity
-Infinity
true
false
true
false
"Something" // String
'c' // char
"Something" // string
'Something' // string
"s" // string
's' // string
!true // = false
!false // = true
!true // = false
!false // = true
1 == 1 // = true
1 != 1 // = true
'1' == 1 // = error
"false" == "bar" // = true
"false" == false // = error
"false".equals("bar") // = false
// equality check
1 == 1 // = true
1 != 1 // = true
'1' == 1 // = true
"false" == "bar" // = false
"false" == false // = true
// strict equality check
1 === 1 // = true
1 !== 1 // = true
'1' === 1 // = false
"false" === "bar" // = false
"false" === false // = false
1 < 10; // = true
1 > 10; // = false
2 <= 2; // = true
2 >= 2; // = true
1 < 10; // = true
1 > 10; // = false
2 <= 2; // = true
2 >= 2; // = true
"Hello " + "world!"; // = "Hello world!"
"1, 2, " + 3; // = "1, 2, 3"
"Hello " + "world!"; // = "Hello world!"
"1, 2, " + 3; // = "1, 2, 3"
"Hello " + ["world", "!"]; // = "Hello world,!"
"a" < "b"; // = true
"This is a string".charAt(0); // = 'T'
"Hello".length(); // = 5
"This is a string".charAt(0); // = 'T'
"Hello".length; // = 5
null
null;
undefined;
// false, null, undefined, NaN, 0 and "" are falsy; everything else is truthy.
// Note that 0 is falsy and "0" is truthy, even though 0 == "0".
String name = "Manusia bernapas";
int age = 12;
boolean hasHighscore = true;
int a = 0, b = 0, c = 0;
// 3 keywords
name = "Manusia Bernapas";
var name = "Manusia Bernapas";
let name = "Manusia Bernapas";
const name = "Manusia Bernapas";
const a = 0, b = 0, c = 0;
i++;
i--;
++i;
--i;
i += 1;
i -= 2;
i *= 3;
i++;
i--;
++i;
--i;
i += 1;
i -= 2;
i *= 3;
String[] foo = { "1", "2", "3" };
foo[2] // = "3"
foo.size() // = 3
foo[2] = "4" // = { "1", "2", "4" }
const foo = ["1", 30, false];
foo[2] // = 30
foo.push("World");
foo.length; // = 4
foo[2] = 123 // = ["1", 30, 123]
// sebenernya bisa pake class
// tapi nanti di Javascript juga ada class yang lebih mirip
// class di Javascript under the hood itu pakenya object juga
// tapi dikasih syntactical sugar biar mirip kaya class biasanya
const person = {
  name: "Manusia Bernapas",
  age: 12,
  "has highscore": true
}
person.name // = "Manusia Bernapas"
person.age = 20 // person.age === 20
person["has highscore"] // = true
int number = 2;
if (number > 2) {
  System.out.println("Number is bigger than 2");
} else if (number == 2) {
  System.out.println("Number is equal to 2");
} else {
  System.out.println("Number is smaller or equal to 2");
}
const number = 2;
if (number > 2) {
  console.log("Number is bigger than 2");
} else if (number === 2) {
  console.log("Number is equal to 2");
} else {
  console.log("Number is smaller or equal to 2");
}
while (condition) {
  // do something
}
while (condition) {
  // do something
}
do {
  // do something
} while (condition)
do {
  // do something
} while (condition)
for (int i = 0; i < 10; i++) {
  System.out.println(i);
}
for (let i = 0; i < 10; i++) {
  console.log(i);
}
char grade = 'B';
switch (grade) {
  case 'A':
    System.out.println("Great job");
    break;
  case 'B':
    System.out.println("OK job");
    break;
  case 'C':
    System.out.println("You can do better");
    break;
  default:
    System.out.println("Oy vey");
    break;
}
const grade = 'B';
switch (grade) {
  case 'A':
    console.log("Great job");
    break;
  case 'B':
    console.log("OK job");
    break;
  case 'C':
    console.log("You can do better");
    break;
  default:
    console.log("Oy vey");
    break;
}
String upper(String text) {
  return text.toUpperCase();
}
upper("foo"); // = "FOO"

function upper(text) {
return text.toUpperCase();
}
upper("foo"); // = "FOO"
(String text) -> text.toUpperCase();
const upper = (text) => {
  return text.toUpperCase()
};
const upper = (text) => text.toUpperCase();
upper("foo"); // = "FOO"
[1, 2, 3].map((f) => f * 2) // = [2, 4, 6]
[1, 2, 3].map((f) => f * 2) // = [2, 4, 6]