This file contains hidden or 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
export function wrapApiCall< | |
T extends (...args: any[]) => Promise<{ data: any; error: any }>, | |
>( | |
apiCall: T, | |
): ( | |
...args: Parameters<T> | |
) => Promise< | |
ReturnType<T> extends Promise<{ data: infer TData; error: infer TError }> | |
? TData | |
: never |
This file contains hidden or 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
const express = require('express'); | |
const app = express(); | |
const bcrypt = require('bcryptjs'); | |
const jwt = require('jsonwebtoken'); | |
const session = require('express-session'); | |
// User model | |
const User = require('./models/user'); | |
// Login form |
This file contains hidden or 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
// 1. Buat fungsi "calculateDiscountedPrice" yang menerima number, lalu mengembalikan number | |
// dengan value yang sudah dipotong 20% dari harga aslinya. | |
function calculateDiscountedPrice(inputNumber) { | |
return; // todo | |
} | |
// 2. Buat fungsi "convertIntoDiscountedItem" yang menerima input berbentuk { name:string, price:number } | |
// lalu menghasilkan output { name:string, price:number } (sama) dengan property price-nya dipotong 20% | |
function convertIntoDiscountedItem(inputObj) { | |
return; //todo |
This file contains hidden or 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
// 1. Buat fungsi "plusOne" yang menghasilkan 1 + input yang diberikan. | |
function plusOne(input) { | |
return; // todo | |
} | |
console.log(plusOne(1)); | |
console.log(plusOne(2)); | |
console.log(plusOne(5)); | |
// 2. buat fungsi "minusOne" yang menghasilkan input - 1. | |
function minusOne(input) { |
This file contains hidden or 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
// 1. Ubah data ini menjadi number | |
const stringNumber = "1285"; | |
// ๐๐๐๐๐๐ Ubah code di bawah ini | |
const number = 0; | |
// ๐๐๐๐๐๐ Ubah code di atas ini | |
console.log(number === 1285 ? "Bener" : "Salah"); | |
// 2. Apa hasil console.log di bawah? |
This file contains hidden or 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
var movies = [ | |
{ | |
"id": 70111470, | |
"title": "Die Hard", | |
"boxart": "http://cdn-0.nflximg.com/images/2891/DieHard.jpg", | |
"uri": "http://api.netflix.com/catalog/titles/movies/70111470", | |
"rating": 4.0, | |
"bookmark": [] | |
}, | |
{ |
This file contains hidden or 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
var movieLists = [ | |
{ | |
name: "New Releases", | |
videos: [ | |
{ | |
"id": 70111470, | |
"title": "Die Hard", | |
"boxart": "http://cdn-0.nflximg.com/images/2891/DieHard.jpg", | |
"uri": "http://api.netflix.com/catalog/titles/movies/70111470", | |
"rating": 4.0, |
This file contains hidden or 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
var newReleases = [ | |
{ | |
"id": 70111470, | |
"title": "Die Hard", | |
"boxart": "http://cdn-0.nflximg.com/images/2891/DieHard.jpg", | |
"uri": "http://api.netflix.com/catalog/titles/movies/70111470", | |
"rating": [4.0], | |
"bookmark": [] | |
}, | |
{ |
This file contains hidden or 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
import React, {useState} from 'react'; | |
import { | |
Dimensions, | |
FlatList, | |
StyleSheet, | |
Text, | |
TouchableOpacity, | |
View, | |
} from 'react-native'; | |
import {useSelector} from 'react-redux'; |