1

just started learning javascript this week. I have a very noob question. What does exports.displayName = (undefined: ?string); means in react native?

Is this trying to initialize undefined to exports.displayName as string

Thanks coders!

phongyewtong
  • 4,531
  • 11
  • 48
  • 71
  • 4
    Can you please add some of your code that's giving this error ? – Ateev Chopra Sep 26 '15 at 15:01
  • Have you googled the error? http://stackoverflow.com/questions/9522233/javascript-undefined-empty-strings-and-if-statements – jmargolisvt Sep 26 '15 at 15:01
  • Are you using ternary operator?.If yes take a look at this link https://msdn.microsoft.com/en-us/library/be21c7hw(VS.94).aspx – brk Sep 26 '15 at 15:02
  • ?: its conditional operator it will work as if else condition. – VRK Sep 26 '15 at 15:02
  • Is this supposed to be code? Or some output? It's definitely not standard JavaScript. Please provide more context. – Felix Kling Sep 26 '15 at 15:12
  • Sorry I wasnt clear enough. I saw this in react native and i not quite sure what is it trying to do? is it trying to initialize undefined to exports.displayName as string? – phongyewtong Sep 26 '15 at 15:18
  • Duplicate of [Javascript syntax null : ?{}](http://stackoverflow.com/q/32721630/218196) – Felix Kling Sep 26 '15 at 22:00

1 Answers1

1

Looks like a (Flow? TypeScript?) type annotation for an optional string. It is not Javascript syntax. Yes, it does initialise exports.displayName with the value undefined.

Bergi
  • 572,313
  • 128
  • 898
  • 1,281