上一页 1 ··· 107 108 109 110 111 112 113 114 115 ··· 492 下一页
摘要: fallthrough keyword is used in switch statement in golang. This keyword is used in switch case block. If the fallthrough keyword is present in the cas 阅读全文
posted @ 2022-09-04 16:19 Zhentiw 阅读(57) 评论(0) 推荐(0)
摘要: // 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 阅读(23) 评论(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 阅读(19) 评论(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 阅读(32) 评论(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 阅读(26) 评论(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 阅读(22) 评论(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 阅读(40) 评论(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 阅读(30) 评论(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 阅读(40) 评论(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 阅读(29) 评论(0) 推荐(0)
上一页 1 ··· 107 108 109 110 111 112 113 114 115 ··· 492 下一页