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
// Object.create | |
const obj = Object.create(null, { | |
foo: { value: 'bar' }, | |
bar: { value: 42 }, | |
baz: { value: true} | |
}); |
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
const array = ['A', 'B', 'C', 'D', 'E'] | |
array.splice(0, 1) //從索引 0 的位置開始,刪除 1 個元素。 ['B', 'C', 'D', 'E'] | |
array.splice(0, 0, 'P') //從索引 0 的位置開始,新增 'P'。 ['P', 'B', 'C', 'D', 'E'] | |
array.splice(1, 3, 'Z', 'X') //從索引 1 的位置開始,刪除 3 個元素,新增 'Z'、'X'。 ['B', 'Z', 'X'] |
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
const array = ['A', 'B', 'C', 'D', 'E'] | |
console.log(array.slice()) // ['A', 'B', 'C', 'D', 'E'] ,沒有參數,全部拷貝 | |
console.log(array.slice(5)) // [] 如果begin 超過陣列長度會回傳空字串 | |
console.log(array.slice(-1)) // ['E'],begin 是 -1 ,表示從最後一個元素拷貝 | |
console.log(array.slice(-2)) // ['D', 'E'],begin 是 -2,表示從最後兩個開始拷貝 | |
console.log(array.slice(0, 2)) // ['A', 'B'] begin 是 0 到 2 (不包含2) | |
console.log(array.slice(0, -1)) // ['A', 'B', 'C', 'D'] begin 0 到 -1 (表示最後一個元素但不包含) |
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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include "kk.h" | |
node * readtext(FILE *p) | |
{ | |
char buf[300]; | |
char *ptr; | |
int i=0; | |
node * last=NULL; |