Hello world

    • Deno can run JavaScript or TypeScript out of the box with no additional tools or config required.

    In this JavaScript example the message is printed to the console and the code ensures the name provided is capitalized.

    This TypeScript example is exactly the same as the JavaScript example above, the code just has the additional type information which TypeScript supports.

    Command: deno run hello-world.ts

    1. /**
    2. * hello-world.ts
    3. */
    4. return word.charAt(0).toUpperCase() + word.slice(1);
    5. }
    6. function hello(name: string): string {
    7. return "Hello " + capitalize(name);
    8. }
    9. console.log(hello("john"));
    10. console.log(hello("kai"));
    11. /**
    12. * Output:
    13. *
    14. * Hello John
    15. * Hello Sarah
    16. * Hello Kai