上一页 1 ··· 113 114 115 116 117 118 119 120 121 ··· 498 下一页
摘要: // Defined a err variable err and assige the return value of someFunction() // err only available in if {} block, not outside if err := someFunction() 阅读全文
posted @ 2022-09-04 16:02 Zhentiw 阅读(32) 评论(0) 推荐(0)
摘要: package main import ( "fmt" ) func main() { var firstName string = "firstName" var lastName = "lastName" var fullName string // Go will assign default 阅读全文
posted @ 2022-09-04 15:58 Zhentiw 阅读(29) 评论(0) 推荐(0)
摘要: Can use reflect.TypeOf to get variable type package main import ( "fmt" "reflect" ) func main() { // var age int = 21 // var b bool = age >= 23 var ag 阅读全文
posted @ 2022-09-04 15:52 Zhentiw 阅读(42) 评论(0) 推荐(0)
摘要: Implement the built-in Parameters generic without using it. For example: const foo = (arg1: string, arg2: number): void => {} type FunctionParamsType 阅读全文
posted @ 2022-09-03 23:44 Zhentiw 阅读(37) 评论(0) 推荐(0)
摘要: Implement the type version of Array.unshift For example: type Result = Unshift<[1, 2], 0> // [0, 1, 2,] /* _____________ Your Code Here _____________ 阅读全文
posted @ 2022-09-03 23:34 Zhentiw 阅读(25) 评论(0) 推荐(0)
摘要: Implement the generic version of Array.push For example: type Result = Push<[1, 2], '3'> // [1, 2, '3'] /* _____________ Your Code Here _____________ 阅读全文
posted @ 2022-09-03 23:31 Zhentiw 阅读(42) 评论(0) 推荐(0)
摘要: Implement the Equal<T, U> For example: type isEqual = Equal<1, 1> // true Idea: Parameter type: <P>(x: P) => any Check P extends T ? 1: 2 Then check P 阅读全文
posted @ 2022-09-03 23:30 Zhentiw 阅读(38) 评论(0) 推荐(0)
摘要: Creating a CLI in Node.js just takes a extra step or two because they are really just an ordinary Node.js app wrapped behind a bin command. For this e 阅读全文
posted @ 2022-09-02 22:09 Zhentiw 阅读(53) 评论(0) 推荐(0)
摘要: Implement the JavaScript Array.includes function in the type system. A type takes the two arguments. The output should be a boolean true or false. For 阅读全文
posted @ 2022-09-02 20:19 Zhentiw 阅读(41) 评论(0) 推荐(0)
摘要: Implement the JavaScript Array.concat function in the type system. A type takes the two arguments. The output should be a new array that includes inpu 阅读全文
posted @ 2022-09-02 19:20 Zhentiw 阅读(49) 评论(0) 推荐(0)
上一页 1 ··· 113 114 115 116 117 118 119 120 121 ··· 498 下一页