【javascript】配列の中から複数の要素を取り出したい
発生している問題・エラーメッセージ
要素をn回削除するようにして複数の要素を取り出そうとしたのですがうまくいきません。
splice is not a funciton
該当のソースコード
[html] <!DOCTYPE html> <html> <head> <meta content="text/html; charset=shift_jis" http-equiv"Content=Type" /> <title></title> <link rel="stylesheet" type="text/css" href="背景など.css"> </head> <body> <h1>マインスイーパーランダム</h1> <table id="field"> <tr> <td></td><td></td><td></td> </tr> <tr> <td></td><td></td><td></td> </tr> <tr> <td></td><td></td><td></td> </tr> </table> <script src="moving.js"></script> </body> </html> [js] var array = document.getElementsByTagName('td'); var rand = Math.floor(Math.random()*array.length); array.splice(rand,1); console.log(array);
補足情報(FW/ツールのバージョンなど)
google chromeで検証(バージョン: 72.0.3626.96(Official Build))

回答4件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。