0

I have seen code of the form

functionName(isTrue: ?boolean = true) { //I came know that isTrue is parameter, of boolean type with true as default value
    if(isTrue) {
        //true Block
    }
    else {
       //false block
    }
}

I am new to Javascript, and using react-native from 3 months. So I know that this is a kind of declaration of functions.

I want to know:

  1. where is the documentation for such types of declarations.
  2. if this kind of declaration is known by any name?
0

1 Answer 1

1

I think you are confusing TypeScript with JavaScript. The code snippet you have posted is in TypeScript. TypeScript is a superset of JavaScript developed by Microsoft.

To understand more about how functions work in TypeScript refer this, https://www.typescriptlang.org/docs/handbook/functions.html

To understand and learn TypeScript, in general, I would suggest you start with the docs, https://www.typescriptlang.org/docs/home

Once you are done with that take some course on some online platform like Udemy, Pluralsight etc...

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

Comments

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.