Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

An Introduction to Scala JS

A safer way to build robust front-end web applications!

  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

An Introduction to Scala JS

  1. 1. Presented By: Divyanshu Srivastava Software Consultant
  2. 2. Lack of etiquette and manners is a huge turn off. KnolX Etiquettes Punctuality Respect Knolx session timings, you are requested not to join sessions after a 5 minutes threshold post the session start time. Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter. Mute Be on mute until you have questions or concerns. Avoid Disturbance Avoid unwanted chit chat during the session.
  3. 3. ● ● ● ● ● ● ● ●
  4. 4. ● Correctness :- ● Performance :- ● Interoperability:- ● Excellent editor support: -
  5. 5. class Person { constructor(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; } fullName() { return `${this.firstName} ${this.lastName}`; } } class Person(val firstName: String, val lastName: String) { def fullName(): String = s"$firstName $lastName" }
  6. 6. console.log("Hello World!"); println("Hello World!") const names = persons .map(p => p.firstName); val names = persons .map(p => p.firstName) val names = persons.map(_.firstName)
  7. 7. const personMap = new Map([ [10, new Person("Roger", "Moore")], [20, new Person("James", "Bond")]]); const names = []; for (const [key, person] of personMap) { if (key > 15) { names.push(`${key} = ${person.firstName}`); } } val personMap = Map( 10 -> new Person("Roger", "Moore"), 20 -> new Person("James", "Bond")) val names = for { (key, person) <- personMap if key > 15 } yield s"$key = ${person.firstName}"
  8. 8. const xhr = new XMLHttpRequest(); xhr.open("GET", "http://localhost:8080”); xhr.onload = (e) => { if (xhr.status === 200) { const r = JSON.parse(xhr.responseText); $("#id").html(parse(r)); } }; xhr.send(); val xhr = new XMLHttpRequest() xhr.open("GET", "http://localhost:8080”) xhr.onload = { (e: Event) => if (xhr.status == 200) { val r = JSON.parse(xhr.responseText) $("#id").html(parse(r)) } } xhr.send()
  9. 9. class Person { public firstName: String; public lastName: String; constructor(firstName: string, lastName: string) { this.firstName = firstName; this.lastName = lastName; } fullName() { return `${this.firstName} ${this.lastName}`; } } class Person(val firstName: String, val lastName: String) { def fullName(): String = s"$firstName $lastName" }
  10. 10. console.log("Hello World!"); println("Hello World!") const names = persons .map(p => p.firstName); val names = persons .map(p => p.firstName) val names = persons.map(_.firstName)
  11. 11. const personMap = new Map<number, Person>([ [10, new Person("Roger", "Moore")], [20, new Person("James", "Bond")]]); const names = new Array<string>(); for (const [key, person] of personMap) { if (key > 15) { names.push(`${key} = ${person.firstName}`); } } val personMap = Map( 10 -> new Person("Roger", "Moore"), 20 -> new Person("James", "Bond")) val names = for { (key, person) <- personMap if key > 15 } yield s"$key = ${person.firstName}"
  12. 12. DEMO
  13. 13. ● ● ●
  14. 14. ● ● ● ●

×