Kotlin与Swift 从零开始(一)基础语法,2024年最新binder 面试

先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7

深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年最新Web前端全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
img
img
img
img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上前端开发知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

如果你需要这些资料,可以添加V获取:vip1024c (备注前端)
img

正文

“Malcolm” to “Captain”,

“Kaylee” to “Mechanic”

)

occupations[“Jayne”] = “Public Relations”

空集合

Swift

let emptyArray = String

let emptyDictionary = String: Float

Kotlin

val emptyArray = arrayOf()

val emptyMap = mapOf<String, Float>()

FUNCTIONS

函数

Swift

func greet(_ name: String,_ day: String) -> String {

return “Hello (name), today is (day).”

}

greet(“Bob”, “Tuesday”)

Kotlin

fun greet(name: String, day: String): String {

return “Hello $name, today is $day.”

}

greet(“Bob”, “Tuesday”)

元组返回

Swift

func getGasPrices() -> (Double, Double, Double) {

return (3.59, 3.69, 3.79)

}

Kotlin

data class GasPrices(val a: Double, val b: Double,

val c: Double)

fun getGasPrices() = GasPrices(3.59, 3.69, 3.79)

参数的变量数目(Variable Number Of Arguments)

Swift

func sumOf(_ numbers: Int…) -> Int {

var sum = 0

for number in numbers {

sum += number

}

return sum

}

sumOf(42, 597, 12)

Kotlin

fun sumOf(vararg numbers: Int): Int {

var sum = 0

for (number in numbers) {

sum += number

}

return sum

}

sumOf(42, 597, 12)

// sumOf() can also be written in a shorter way:

fun sumOf(vararg numbers: Int) = numbers.sum()

函数类型

Swift

func makeIncrementer() -> (Int -> Int) {

func addOne(number: Int) -> Int {

return 1 + number

}

return addOne

}

let increment = makeIncrementer()

increment(7)

Kotlin

fun makeIncrementer(): (Int) -> Int {

val addOne = fun(number: Int): Int {

return 1 + number

}

return addOne

}

val increment = makeIncrementer()

increment(7)

// makeIncrementer can also be written in a shorter way:

fun makeIncrementer() = fun(number: Int) = 1 + number

映射

Swift

let numbers = [20, 19, 7, 12]

numbers.map { 3 * $0 }

Kotlin

val numbers = listOf(20, 19, 7, 12)

numbers.map { 3 * it }

排序

Swift

var mutableArray = [1, 5, 3, 12, 2]

mutableArray.sort()

Kotlin

listOf(1, 5, 3, 12, 2).sorted()

命名参数

Swift

func area(width: Int, height: Int) -> Int {

return width * height

}

area(width: 2, height: 3)

Kotlin

fun area(width: Int, height: Int) = width * height

area(width = 2, height = 3)

// This is also possible with named arguments

area(2, height = 2)

area(height = 3, width = 2)

CLASSES

声明

Swift

class Shape {

var numberOfSides = 0

func simpleDescription() -> String {

return “A shape with (numberOfSides) sides.”

}

}

Kotlin

class Shape {

var numberOfSides = 0

fun simpleDescription() =

“A shape with $numberOfSides sides.”

}

用法

Swift

var shape = Shape()

shape.numberOfSides = 7

var shapeDescription = shape.simpleDescription()

Kotlin

var shape = Shape()

shape.numberOfSides = 7

var shapeDescription = shape.simpleDescription()

子类

Swift

class NamedShape {

var numberOfSides: Int = 0

let name: String

init(name: String) {

self.name = name

}

func simpleDescription() -> String {

return “A shape with (numberOfSides) sides.”

}

}

class Square: NamedShape {

var sideLength: Double

init(sideLength: Double, name: String) {

self.sideLength = sideLength

super.init(name: name)

self.numberOfSides = 4

}

func area() -> Double {

return sideLength * sideLength

}

override func simpleDescription() -> String {

return "A square with sides of length " +

sideLength + “.”

}

}

let test = Square(sideLength: 5.2, name: “square”)

test.area()

test.simpleDescription()

Kotlin

open class NamedShape(val name: String) {

var numberOfSides = 0

open fun simpleDescription() =

“A shape with $numberOfSides sides.”

}

class Square(var sideLength: BigDecimal, name: String) :

NamedShape(name) {

init {

numberOfSides = 4

}

fun area() = sideLength.pow(2)

override fun simpleDescription() =

“A square with sides of length $sideLength.”

}

val test = Square(BigDecimal(“5.2”), “square”)

test.area()

test.simpleDescription()

类型检查

Swift

var movieCount = 0

var songCount = 0

for item in library {

if item is Movie {

movieCount += 1

} else if item is Song {

songCount += 1

}

}

Kotlin

var movieCount = 0

var songCount = 0

for (item in library) {

if (item is Movie) {

++movieCount

} else if (item is Song) {

++songCount

}

}

模式匹配

Swift

let nb = 42

switch nb {

case 0…7, 8, 9: print(“single digit”)

case 10: print(“double digits”)

case 11…99: print(“double digits”)

case 100…999: print(“triple digits”)

default: print(“four or more digits”)

}

Kotlin

val nb = 42

when (nb) {

in 0…7, 8, 9 -> println(“single digit”)

10 -> println(“double digits”)

in 11…99 -> println(“double digits”)

in 100…999 -> println(“triple digits”)

else -> println(“four or more digits”)

}

类型向下转换

Swift

for current in someObjects {

if let movie = current as? Movie {

print("Movie: ‘(movie.name)’, " +

“dir. (movie.director)”)

}

}

Kotlin

for (current in someObjects) {

if (current is Movie) {

println("Movie: ‘${current.name}’, " +

React

  • 介绍一下react

  • React单项数据流

  • react生命周期函数和react组件的生命周期

  • react和Vue的原理,区别,亮点,作用

  • reactJs的组件交流

  • 有了解过react的虚拟DOM吗,虚拟DOM是怎么对比的呢

  • 项目里用到了react,为什么要选择react,react有哪些好处

  • 怎么获取真正的dom

  • 选择react的原因

  • react的生命周期函数

  • setState之后的流程

  • react高阶组件知道吗?

  • React的jsx,函数式编程

  • react的组件是通过什么去判断是否刷新的

  • 如何配置React-Router

  • 路由的动态加载模块

  • Redux中间件是什么东西,接受几个参数

  • redux请求中间件如何处理并发

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以添加V获取:vip1024c (备注前端)
img

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
件交流

  • 有了解过react的虚拟DOM吗,虚拟DOM是怎么对比的呢

  • 项目里用到了react,为什么要选择react,react有哪些好处

  • 怎么获取真正的dom

  • 选择react的原因

  • react的生命周期函数

  • setState之后的流程

  • react高阶组件知道吗?

  • React的jsx,函数式编程

  • react的组件是通过什么去判断是否刷新的

  • 如何配置React-Router

  • 路由的动态加载模块

  • Redux中间件是什么东西,接受几个参数

  • redux请求中间件如何处理并发

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以添加V获取:vip1024c (备注前端)
[外链图片转存中…(img-Z19w1HrR-1713321911407)]

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 18
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值