0

Is it possible to replace the function keyword to something smaller like void, sub etc ?

I've seen it being used in libraries like these two:

10
  • 1
    what actually do you want to achieve? Commented May 18, 2013 at 15:50
  • 2
    In JavaScript, it's not. The libraries you posted are things you run text through, that generates JavaScript. The code you write with them isn't necessarily JavaScript Commented May 18, 2013 at 15:51
  • yes, as you said yourself, sweetjs, etc do it. but the browser won't understand it. Commented May 18, 2013 at 15:52
  • @akonsu But is it possible to make one myself? Commented May 18, 2013 at 15:53
  • @user1490835 Writing a smaller keyword than function Commented May 18, 2013 at 15:54

1 Answer 1

4

You can use "typescript" for these things. It is a typed superset of JavaScript that compiles to plain JavaScript. So it is javascript with lots of new features. It is created by Microsoft.

Typescript Official Webpage

Sign up to request clarification or add additional context in comments.

3 Comments

I know that I can use that, but I wanted to do it in plain JavaScript. Apparently, that is not possible.
Yes, not possible. You must use compiler (typescript, coffeescript, sweetjs or something) to work with these.
I accepted your answer. I was a bit confused, thanks for clearing up :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.