Why do we use _ in variable names?

前端 未结 11 1880
一生所求
一生所求 2020-12-25 11:26

I have seen variables like _ image and was wondering what _ meant?

11条回答
  •  轮回少年
    2020-12-25 11:52

    The underscore in variable names is completely optional. Many programmers use it to differentiate private variables - so instance variables will typically have an underscore prepended to the name. This prevents confusion with local variables.

提交回复
热议问题