Andrew_Manu

Wollok funcion lambda

Jul 3rd, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. const hoy = new Date()
  2. const calcularEdad = {n,m => n-m}
  3. const sumar = {n,m => n+m}
  4.  
  5.  
  6. object gatito{
  7.     const fechaNacimiento = new Date(14, 01, 2014)
  8.     var nombre = "Erick"
  9.     var color = "Negro"
  10.     method saberNombre(){ return nombre }
  11.     method saberColor(){ return color }
  12.     method edad(){ return calcularEdad.apply(hoy.year(),fechaNacimiento.year()) }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment