1.HTML 内のスクリプトは、<script> タグと </script> の間に配置する必要があります。
スクリプトは HTML ページの
セクションに配置できます2. JavaScript から HTML 要素にアクセスするには、 document.getElementById(id) メソッドを使用できます
3. document.write() を通じて、タグを含むコンテンツを HTML ドキュメントに書き込むことができます。ドキュメントがロードされた後に document.write() が実行されると、HTML ドキュメント全体が上書きされることに注意してください
4.JS は 2 つの方法でアノテーションを付けます: // と /**/
5. 変数は var を通じて宣言されます。JS は弱い型指定言語であるため、変数の型を指定する必要はありません。
var x=1 //number var x="a" //字符串 var x=true //boolean var x //x无值,undefined
6. 関数使用関数の定義
function 函数名(){ 函数体; }
7.var num=new Number()//Declare a Number object
Number.MAX_VALUE Maximum value
Number.MIN_VALUE Minimum value
Number.NaN special non-numeric value
Number.NEGATIVE_INFINITY Negative infinity
Number.POSITIVE_INFINITY Positive infinity
Number.toExponential() Format numbers using exponential notation
Number.toFixed( ) uses fixed-point counting to format numbers
Number.toLocaleString() Converts numbers into local format strings
Number.toPrecision() Format the significant digits of the number
Number.toString( ) Converts a number into a string
Number.valueOf( ) returns the original value
8.var str = new String() //Declare a string object
str.substr(start,length): Extract and return a substring in str. But it does not modify str. start indicates the starting position of extraction, and length indicates the length. If length is omitted, it indicates extraction to the end.
str.substring(from,to): will return the substring of the string string, consisting of the characters from from to to, including the characters located in from, excluding the characters located in to. If from>to, that is Intercepted after automatic replacement.
Str.toLowerCase(): Convert the string to lowercase
Str.toUpperCase(): Convert the string to uppercase
str.split(): Split the string according to the specified symbol
str.slice(): Same as substring() but more flexible, allowing negative values, similar to Array.slice()
str.concat(): String link, similar to Array.concat, but it is more convenient to use numbers
Str.indexOf(): Retrieve characters and return the position where the character first appears
9.var date=new Date() //Create a date object
Main methods:
Date.get/setDay() //Return/set a day of the week (0~6),
Date.get/setFullYear() // Return/set the year in system time
Date.get/setMonth() // Return/set the month field (0~11) in system time
date.get/setDate() //Return/set a certain day of the month
Date.get/setHours() // Return/set the hour field in the system time
Date.get/setMinutes() // Return/set the minutes field in the system time
Date.get/setSeconds() // Return/set the seconds field in the system time
Date.get/setTime() //Return/Set//Return/Set the minute field in the system time
10.var arr=new Array() //Create an array object
Main attributes: arr.length //Returns the length of the array
Main methods:
pop() //Delete and return the last element of the array, the return value is the deleted element
push() //Add elements to the end of the array and return the length of the array
shift() //Move the first element out of the array, and the return value is the deleted element
unshift() //Insert an element at the head of the array and return the length of the array
slice() //Return a part of the array, the parameter can be a negative value, return the intercepted array
Reverse() //Reverse the order in the array and return the reversed array
sort() //To sort array elements, you need to specify a method
concat() //Array connection, returns the connected array without changing the original array
join() //Join the array elements with the specified characters and return them in string form
splice() //Insert, delete or replace elements of the array,
toString() //Convert the array into a string
11.Math is a native object
Math.abs() //Return the absolute value
Math.ceil() // Round up
Math.floor() // Countryside rounding
Math.round() // Rounding up
Math.randow() // Returns a random number
Math.max() // Return the larger value
Math.min() // Return the smaller value
Math.PI() //Constant PI
Math.pow() // x to the y power
Math.sqrt() // Calculate the square
12. Others
isNaN() // Determine whether it is a numerical value. If not, return true
parseInt() // Forced conversion to integer type
parseFloat() // Forced conversion to floating point value
alert() // Warning
confirm() //Message confirmation box
prompt() //Prompt message box
Document.write() //Write content to the HTML document. If the document content is loaded and written using this method, the entire HTML document will be overwritten
document.getElementById() //Get the object by ID name
document.getElementsTagName() //Get the object through the tag name and return an array object
document.getElementsClassName() //Get the object through the class name and return an array object
The above is the entire content of this article, I hope you all like it.

CおよびJavaScriptは、WebAssemblyを介して相互運用性を実現します。 1)CコードはWebAssemblyモジュールにコンパイルされ、JavaScript環境に導入され、コンピューティングパワーが強化されます。 2)ゲーム開発では、Cは物理エンジンとグラフィックスレンダリングを処理し、JavaScriptはゲームロジックとユーザーインターフェイスを担当します。

JavaScriptは、Webサイト、モバイルアプリケーション、デスクトップアプリケーション、サーバー側のプログラミングで広く使用されています。 1)Webサイト開発では、JavaScriptはHTMLおよびCSSと一緒にDOMを運用して、JQueryやReactなどのフレームワークをサポートします。 2)ReactNativeおよびIonicを通じて、JavaScriptはクロスプラットフォームモバイルアプリケーションを開発するために使用されます。 3)電子フレームワークにより、JavaScriptはデスクトップアプリケーションを構築できます。 4)node.jsを使用すると、JavaScriptがサーバー側で実行され、高い並行リクエストをサポートします。

Pythonはデータサイエンスと自動化により適していますが、JavaScriptはフロントエンドとフルスタックの開発により適しています。 1. Pythonは、データ処理とモデリングのためにNumpyやPandasなどのライブラリを使用して、データサイエンスと機械学習でうまく機能します。 2。Pythonは、自動化とスクリプトにおいて簡潔で効率的です。 3. JavaScriptはフロントエンド開発に不可欠であり、動的なWebページと単一ページアプリケーションの構築に使用されます。 4. JavaScriptは、node.jsを通じてバックエンド開発において役割を果たし、フルスタック開発をサポートします。

CとCは、主に通訳者とJITコンパイラを実装するために使用されるJavaScriptエンジンで重要な役割を果たします。 1)cは、JavaScriptソースコードを解析し、抽象的な構文ツリーを生成するために使用されます。 2)Cは、Bytecodeの生成と実行を担当します。 3)Cは、JITコンパイラを実装し、実行時にホットスポットコードを最適化およびコンパイルし、JavaScriptの実行効率を大幅に改善します。

現実世界でのJavaScriptのアプリケーションには、フロントエンドとバックエンドの開発が含まれます。 1)DOM操作とイベント処理を含むTODOリストアプリケーションを構築して、フロントエンドアプリケーションを表示します。 2)node.jsを介してRestfulapiを構築し、バックエンドアプリケーションをデモンストレーションします。

Web開発におけるJavaScriptの主な用途には、クライアントの相互作用、フォーム検証、非同期通信が含まれます。 1)DOM操作による動的なコンテンツの更新とユーザーインタラクション。 2)ユーザーエクスペリエンスを改善するためにデータを提出する前に、クライアントの検証が実行されます。 3)サーバーとのリフレッシュレス通信は、AJAXテクノロジーを通じて達成されます。

JavaScriptエンジンが内部的にどのように機能するかを理解することは、開発者にとってより効率的なコードの作成とパフォーマンスのボトルネックと最適化戦略の理解に役立つためです。 1)エンジンのワークフローには、3つの段階が含まれます。解析、コンパイル、実行。 2)実行プロセス中、エンジンはインラインキャッシュや非表示クラスなどの動的最適化を実行します。 3)ベストプラクティスには、グローバル変数の避け、ループの最適化、constとletsの使用、閉鎖の過度の使用の回避が含まれます。

Pythonは、スムーズな学習曲線と簡潔な構文を備えた初心者により適しています。 JavaScriptは、急な学習曲線と柔軟な構文を備えたフロントエンド開発に適しています。 1。Python構文は直感的で、データサイエンスやバックエンド開発に適しています。 2。JavaScriptは柔軟で、フロントエンドおよびサーバー側のプログラミングで広く使用されています。


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

SublimeText3 中国語版
中国語版、とても使いやすい

ドリームウィーバー CS6
ビジュアル Web 開発ツール

Safe Exam Browser
Safe Exam Browser は、オンライン試験を安全に受験するための安全なブラウザ環境です。このソフトウェアは、あらゆるコンピュータを安全なワークステーションに変えます。あらゆるユーティリティへのアクセスを制御し、学生が無許可のリソースを使用するのを防ぎます。

MantisBT
Mantis は、製品の欠陥追跡を支援するために設計された、導入が簡単な Web ベースの欠陥追跡ツールです。 PHP、MySQL、Web サーバーが必要です。デモおよびホスティング サービスをチェックしてください。

SublimeText3 英語版
推奨: Win バージョン、コードプロンプトをサポート!
