current position:Home>javascript Variables

javascript Variables

2022-05-15 04:29:13The evening wind blows

Preface

JavaScript Variables are containers for storing data

Defining variables

Use var Keyword declaration variables , The declared variable can be called after assignment

<script> var num = "haha"; document.write(num) </script>

Variable naming rule

  • Can contain letters 、 Numbers 、 Underscores and dollar symbols
  • Must start with a letter
  • Sure $ and _ start ( Generally not recommended )
  • Case sensitive (y and Y It's a different variable )
  • Reserved words ( Such as JavaScript Key words ) Cannot be used as variable name

summary

1、 The variable must use var Keyword statement
2、 Assignment is required after variable declaration , For assignment =
3、 Defining variables should follow the naming rules

copyright notice
author[The evening wind blows],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/135/202205142149359619.html

Random recommended