Browse Source

Helper: Move to let/const.

Mugen87 5 years ago
parent
commit
73a4a45658

+ 3 - 3
src/helpers/ArrowHelper.js

@@ -24,8 +24,8 @@ import { Mesh } from '../objects/Mesh.js';
 import { Line } from '../objects/Line.js';
 import { Vector3 } from '../math/Vector3.js';
 
-var _axis = new Vector3();
-var _lineGeometry, _coneGeometry;
+const _axis = new Vector3();
+let _lineGeometry, _coneGeometry;
 
 function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
 
@@ -86,7 +86,7 @@ ArrowHelper.prototype.setDirection = function ( dir ) {
 
 		_axis.set( dir.z, 0, - dir.x ).normalize();
 
-		var radians = Math.acos( dir.y );
+		const radians = Math.acos( dir.y );
 
 		this.quaternion.setFromAxisAngle( _axis, radians );
 

+ 4 - 4
src/helpers/AxesHelper.js

@@ -12,23 +12,23 @@ function AxesHelper( size ) {
 
 	size = size || 1;
 
-	var vertices = [
+	const vertices = [
 		0, 0, 0,	size, 0, 0,
 		0, 0, 0,	0, size, 0,
 		0, 0, 0,	0, 0, size
 	];
 
-	var colors = [
+	const colors = [
 		1, 0, 0,	1, 0.6, 0,
 		0, 1, 0,	0.6, 1, 0,
 		0, 0, 1,	0, 0.6, 1
 	];
 
-	var geometry = new BufferGeometry();
+	const geometry = new BufferGeometry();
 	geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 	geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
 
-	var material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );
+	const material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );
 
 	LineSegments.call( this, geometry, material );
 

+ 4 - 4
src/helpers/Box3Helper.js

@@ -17,11 +17,11 @@ function Box3Helper( box, color ) {
 
 	color = color || 0xffff00;
 
-	var indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
+	const indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
 
-	var positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];
+	const positions = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 1, - 1, 1, - 1, - 1 ];
 
-	var geometry = new BufferGeometry();
+	const geometry = new BufferGeometry();
 
 	geometry.setIndex( new BufferAttribute( indices, 1 ) );
 
@@ -40,7 +40,7 @@ Box3Helper.prototype.constructor = Box3Helper;
 
 Box3Helper.prototype.updateMatrixWorld = function ( force ) {
 
-	var box = this.box;
+	const box = this.box;
 
 	if ( box.isEmpty() ) return;
 

+ 8 - 8
src/helpers/BoxHelper.js

@@ -9,7 +9,7 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
 import { BufferAttribute } from '../core/BufferAttribute.js';
 import { BufferGeometry } from '../core/BufferGeometry.js';
 
-var _box = new Box3();
+const _box = new Box3();
 
 function BoxHelper( object, color ) {
 
@@ -17,10 +17,10 @@ function BoxHelper( object, color ) {
 
 	if ( color === undefined ) color = 0xffff00;
 
-	var indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
-	var positions = new Float32Array( 8 * 3 );
+	const indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );
+	const positions = new Float32Array( 8 * 3 );
 
-	var geometry = new BufferGeometry();
+	const geometry = new BufferGeometry();
 	geometry.setIndex( new BufferAttribute( indices, 1 ) );
 	geometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );
 
@@ -53,8 +53,8 @@ BoxHelper.prototype.update = function ( object ) {
 
 	if ( _box.isEmpty() ) return;
 
-	var min = _box.min;
-	var max = _box.max;
+	const min = _box.min;
+	const max = _box.max;
 
 	/*
 	  5____4
@@ -72,8 +72,8 @@ BoxHelper.prototype.update = function ( object ) {
 	7: max.x, min.y, min.z
 	*/
 
-	var position = this.geometry.attributes.position;
-	var array = position.array;
+	const position = this.geometry.attributes.position;
+	const array = position.array;
 
 	array[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;
 	array[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;

+ 18 - 18
src/helpers/CameraHelper.js

@@ -16,26 +16,26 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
 import { BufferGeometry } from '../core/BufferGeometry.js';
 import { Float32BufferAttribute } from '../core/BufferAttribute.js';
 
-var _vector = new Vector3();
-var _camera = new Camera();
+const _vector = new Vector3();
+const _camera = new Camera();
 
 function CameraHelper( camera ) {
 
-	var geometry = new BufferGeometry();
-	var material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );
+	const geometry = new BufferGeometry();
+	const material = new LineBasicMaterial( { color: 0xffffff, vertexColors: true, toneMapped: false } );
 
-	var vertices = [];
-	var colors = [];
+	const vertices = [];
+	const colors = [];
 
-	var pointMap = {};
+	const pointMap = {};
 
 	// colors
 
-	var colorFrustum = new Color( 0xffaa00 );
-	var colorCone = new Color( 0xff0000 );
-	var colorUp = new Color( 0x00aaff );
-	var colorTarget = new Color( 0xffffff );
-	var colorCross = new Color( 0x333333 );
+	const colorFrustum = new Color( 0xffaa00 );
+	const colorCone = new Color( 0xff0000 );
+	const colorUp = new Color( 0x00aaff );
+	const colorTarget = new Color( 0xffffff );
+	const colorCross = new Color( 0x333333 );
 
 	// near
 
@@ -130,10 +130,10 @@ CameraHelper.prototype.constructor = CameraHelper;
 
 CameraHelper.prototype.update = function () {
 
-	var geometry = this.geometry;
-	var pointMap = this.pointMap;
+	const geometry = this.geometry;
+	const pointMap = this.pointMap;
 
-	var w = 1, h = 1;
+	const w = 1, h = 1;
 
 	// we need just camera projection matrix inverse
 	// world matrix must be identity
@@ -185,13 +185,13 @@ function setPoint( point, pointMap, geometry, camera, x, y, z ) {
 
 	_vector.set( x, y, z ).unproject( camera );
 
-	var points = pointMap[ point ];
+	const points = pointMap[ point ];
 
 	if ( points !== undefined ) {
 
-		var position = geometry.getAttribute( 'position' );
+		const position = geometry.getAttribute( 'position' );
 
-		for ( var i = 0, l = points.length; i < l; i ++ ) {
+		for ( let i = 0, l = points.length; i < l; i ++ ) {
 
 			position.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z );
 

+ 5 - 5
src/helpers/DirectionalLightHelper.js

@@ -11,9 +11,9 @@ import { Float32BufferAttribute } from '../core/BufferAttribute.js';
 import { BufferGeometry } from '../core/BufferGeometry.js';
 import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
 
-var _v1 = new Vector3();
-var _v2 = new Vector3();
-var _v3 = new Vector3();
+const _v1 = new Vector3();
+const _v2 = new Vector3();
+const _v3 = new Vector3();
 
 function DirectionalLightHelper( light, size, color ) {
 
@@ -29,7 +29,7 @@ function DirectionalLightHelper( light, size, color ) {
 
 	if ( size === undefined ) size = 1;
 
-	var geometry = new BufferGeometry();
+	let geometry = new BufferGeometry();
 	geometry.setAttribute( 'position', new Float32BufferAttribute( [
 		- size, size, 0,
 		size, size, 0,
@@ -38,7 +38,7 @@ function DirectionalLightHelper( light, size, color ) {
 		- size, size, 0
 	], 3 ) );
 
-	var material = new LineBasicMaterial( { fog: false, toneMapped: false } );
+	const material = new LineBasicMaterial( { fog: false, toneMapped: false } );
 
 	this.lightPlane = new Line( geometry, material );
 	this.add( this.lightPlane );

+ 8 - 8
src/helpers/GridHelper.js

@@ -15,18 +15,18 @@ function GridHelper( size, divisions, color1, color2 ) {
 	color1 = new Color( color1 !== undefined ? color1 : 0x444444 );
 	color2 = new Color( color2 !== undefined ? color2 : 0x888888 );
 
-	var center = divisions / 2;
-	var step = size / divisions;
-	var halfSize = size / 2;
+	const center = divisions / 2;
+	const step = size / divisions;
+	const halfSize = size / 2;
 
-	var vertices = [], colors = [];
+	const vertices = [], colors = [];
 
-	for ( var i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {
+	for ( let i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {
 
 		vertices.push( - halfSize, 0, k, halfSize, 0, k );
 		vertices.push( k, 0, - halfSize, k, 0, halfSize );
 
-		var color = i === center ? color1 : color2;
+		const color = i === center ? color1 : color2;
 
 		color.toArray( colors, j ); j += 3;
 		color.toArray( colors, j ); j += 3;
@@ -35,11 +35,11 @@ function GridHelper( size, divisions, color1, color2 ) {
 
 	}
 
-	var geometry = new BufferGeometry();
+	const geometry = new BufferGeometry();
 	geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 	geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
 
-	var material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );
+	const material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );
 
 	LineSegments.call( this, geometry, material );
 

+ 10 - 10
src/helpers/HemisphereLightHelper.js

@@ -12,9 +12,9 @@ import { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js';
 import { OctahedronBufferGeometry } from '../geometries/OctahedronGeometry.js';
 import { BufferAttribute } from '../core/BufferAttribute.js';
 
-var _vector = new Vector3();
-var _color1 = new Color();
-var _color2 = new Color();
+const _vector = new Vector3();
+const _color1 = new Color();
+const _color2 = new Color();
 
 function HemisphereLightHelper( light, size, color ) {
 
@@ -28,14 +28,14 @@ function HemisphereLightHelper( light, size, color ) {
 
 	this.color = color;
 
-	var geometry = new OctahedronBufferGeometry( size );
+	const geometry = new OctahedronBufferGeometry( size );
 	geometry.rotateY( Math.PI * 0.5 );
 
 	this.material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );
 	if ( this.color === undefined ) this.material.vertexColors = true;
 
-	var position = geometry.getAttribute( 'position' );
-	var colors = new Float32Array( position.count * 3 );
+	const position = geometry.getAttribute( 'position' );
+	const colors = new Float32Array( position.count * 3 );
 
 	geometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );
 
@@ -57,7 +57,7 @@ HemisphereLightHelper.prototype.dispose = function () {
 
 HemisphereLightHelper.prototype.update = function () {
 
-	var mesh = this.children[ 0 ];
+	const mesh = this.children[ 0 ];
 
 	if ( this.color !== undefined ) {
 
@@ -65,14 +65,14 @@ HemisphereLightHelper.prototype.update = function () {
 
 	} else {
 
-		var colors = mesh.geometry.getAttribute( 'color' );
+		const colors = mesh.geometry.getAttribute( 'color' );
 
 		_color1.copy( this.light.color );
 		_color2.copy( this.light.groundColor );
 
-		for ( var i = 0, l = colors.count; i < l; i ++ ) {
+		for ( let i = 0, l = colors.count; i < l; i ++ ) {
 
-			var color = ( i < ( l / 2 ) ) ? _color1 : _color2;
+			const color = ( i < ( l / 2 ) ) ? _color1 : _color2;
 
 			colors.setXYZ( i, color.r, color.g, color.b );
 

+ 6 - 6
src/helpers/PlaneHelper.js

@@ -17,11 +17,11 @@ function PlaneHelper( plane, size, hex ) {
 
 	this.size = ( size === undefined ) ? 1 : size;
 
-	var color = ( hex !== undefined ) ? hex : 0xffff00;
+	const color = ( hex !== undefined ) ? hex : 0xffff00;
 
-	var positions = [ 1, - 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0 ];
+	const positions = [ 1, - 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0 ];
 
-	var geometry = new BufferGeometry();
+	const geometry = new BufferGeometry();
 	geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
 	geometry.computeBoundingSphere();
 
@@ -31,9 +31,9 @@ function PlaneHelper( plane, size, hex ) {
 
 	//
 
-	var positions2 = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, - 1, 1, 1, - 1, 1 ];
+	const positions2 = [ 1, 1, 1, - 1, 1, 1, - 1, - 1, 1, 1, 1, 1, - 1, - 1, 1, 1, - 1, 1 ];
 
-	var geometry2 = new BufferGeometry();
+	const geometry2 = new BufferGeometry();
 	geometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) );
 	geometry2.computeBoundingSphere();
 
@@ -46,7 +46,7 @@ PlaneHelper.prototype.constructor = PlaneHelper;
 
 PlaneHelper.prototype.updateMatrixWorld = function ( force ) {
 
-	var scale = - this.plane.constant;
+	let scale = - this.plane.constant;
 
 	if ( Math.abs( scale ) < 1e-8 ) scale = 1e-8; // sign does not matter
 

+ 6 - 6
src/helpers/PointLightHelper.js

@@ -14,8 +14,8 @@ function PointLightHelper( light, sphereSize, color ) {
 
 	this.color = color;
 
-	var geometry = new SphereBufferGeometry( sphereSize, 4, 2 );
-	var material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );
+	const geometry = new SphereBufferGeometry( sphereSize, 4, 2 );
+	const material = new MeshBasicMaterial( { wireframe: true, fog: false, toneMapped: false } );
 
 	Mesh.call( this, geometry, material );
 
@@ -28,13 +28,13 @@ function PointLightHelper( light, sphereSize, color ) {
 
 
 	/*
-	var distanceGeometry = new THREE.IcosahedronBufferGeometry( 1, 2 );
-	var distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
+	const distanceGeometry = new THREE.IcosahedronBufferGeometry( 1, 2 );
+	const distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
 
 	this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
 	this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );
 
-	var d = light.distance;
+	const d = light.distance;
 
 	if ( d === 0.0 ) {
 
@@ -74,7 +74,7 @@ PointLightHelper.prototype.update = function () {
 	}
 
 	/*
-	var d = this.light.distance;
+	const d = this.light.distance;
 
 	if ( d === 0.0 ) {
 

+ 16 - 19
src/helpers/PolarGridHelper.js

@@ -19,25 +19,22 @@ function PolarGridHelper( radius, radials, circles, divisions, color1, color2 )
 	color1 = new Color( color1 !== undefined ? color1 : 0x444444 );
 	color2 = new Color( color2 !== undefined ? color2 : 0x888888 );
 
-	var vertices = [];
-	var colors = [];
-
-	var x, z;
-	var v, i, j, r, color;
+	const vertices = [];
+	const colors = [];
 
 	// create the radials
 
-	for ( i = 0; i <= radials; i ++ ) {
+	for ( let i = 0; i <= radials; i ++ ) {
 
-		v = ( i / radials ) * ( Math.PI * 2 );
+		const v = ( i / radials ) * ( Math.PI * 2 );
 
-		x = Math.sin( v ) * radius;
-		z = Math.cos( v ) * radius;
+		const x = Math.sin( v ) * radius;
+		const z = Math.cos( v ) * radius;
 
 		vertices.push( 0, 0, 0 );
 		vertices.push( x, 0, z );
 
-		color = ( i & 1 ) ? color1 : color2;
+		const color = ( i & 1 ) ? color1 : color2;
 
 		colors.push( color.r, color.g, color.b );
 		colors.push( color.r, color.g, color.b );
@@ -46,20 +43,20 @@ function PolarGridHelper( radius, radials, circles, divisions, color1, color2 )
 
 	// create the circles
 
-	for ( i = 0; i <= circles; i ++ ) {
+	for ( let i = 0; i <= circles; i ++ ) {
 
-		color = ( i & 1 ) ? color1 : color2;
+		const color = ( i & 1 ) ? color1 : color2;
 
-		r = radius - ( radius / circles * i );
+		const r = radius - ( radius / circles * i );
 
-		for ( j = 0; j < divisions; j ++ ) {
+		for ( let j = 0; j < divisions; j ++ ) {
 
 			// first vertex
 
-			v = ( j / divisions ) * ( Math.PI * 2 );
+			let v = ( j / divisions ) * ( Math.PI * 2 );
 
-			x = Math.sin( v ) * r;
-			z = Math.cos( v ) * r;
+			let x = Math.sin( v ) * r;
+			let z = Math.cos( v ) * r;
 
 			vertices.push( x, 0, z );
 			colors.push( color.r, color.g, color.b );
@@ -78,11 +75,11 @@ function PolarGridHelper( radius, radials, circles, divisions, color1, color2 )
 
 	}
 
-	var geometry = new BufferGeometry();
+	const geometry = new BufferGeometry();
 	geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 	geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
 
-	var material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );
+	const material = new LineBasicMaterial( { vertexColors: true, toneMapped: false } );
 
 	LineSegments.call( this, geometry, material );
 

+ 19 - 19
src/helpers/SkeletonHelper.js

@@ -15,13 +15,13 @@ import { BufferGeometry } from '../core/BufferGeometry.js';
 import { Float32BufferAttribute } from '../core/BufferAttribute.js';
 import { Object3D } from '../core/Object3D.js';
 
-var _vector = new Vector3();
-var _boneMatrix = new Matrix4();
-var _matrixWorldInv = new Matrix4();
+const _vector = new Vector3();
+const _boneMatrix = new Matrix4();
+const _matrixWorldInv = new Matrix4();
 
 function getBoneList( object ) {
 
-	var boneList = [];
+	const boneList = [];
 
 	if ( object && object.isBone ) {
 
@@ -29,7 +29,7 @@ function getBoneList( object ) {
 
 	}
 
-	for ( var i = 0; i < object.children.length; i ++ ) {
+	for ( let i = 0; i < object.children.length; i ++ ) {
 
 		boneList.push.apply( boneList, getBoneList( object.children[ i ] ) );
 
@@ -41,19 +41,19 @@ function getBoneList( object ) {
 
 function SkeletonHelper( object ) {
 
-	var bones = getBoneList( object );
+	const bones = getBoneList( object );
 
-	var geometry = new BufferGeometry();
+	const geometry = new BufferGeometry();
 
-	var vertices = [];
-	var colors = [];
+	const vertices = [];
+	const colors = [];
 
-	var color1 = new Color( 0, 0, 1 );
-	var color2 = new Color( 0, 1, 0 );
+	const color1 = new Color( 0, 0, 1 );
+	const color2 = new Color( 0, 1, 0 );
 
-	for ( var i = 0; i < bones.length; i ++ ) {
+	for ( let i = 0; i < bones.length; i ++ ) {
 
-		var bone = bones[ i ];
+		const bone = bones[ i ];
 
 		if ( bone.parent && bone.parent.isBone ) {
 
@@ -69,7 +69,7 @@ function SkeletonHelper( object ) {
 	geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 	geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
 
-	var material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );
+	const material = new LineBasicMaterial( { vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true } );
 
 	LineSegments.call( this, geometry, material );
 
@@ -90,16 +90,16 @@ SkeletonHelper.prototype.isSkeletonHelper = true;
 
 SkeletonHelper.prototype.updateMatrixWorld = function ( force ) {
 
-	var bones = this.bones;
+	const bones = this.bones;
 
-	var geometry = this.geometry;
-	var position = geometry.getAttribute( 'position' );
+	const geometry = this.geometry;
+	const position = geometry.getAttribute( 'position' );
 
 	_matrixWorldInv.getInverse( this.root.matrixWorld );
 
-	for ( var i = 0, j = 0; i < bones.length; i ++ ) {
+	for ( let i = 0, j = 0; i < bones.length; i ++ ) {
 
-		var bone = bones[ i ];
+		const bone = bones[ i ];
 
 		if ( bone.parent && bone.parent.isBone ) {
 

+ 9 - 9
src/helpers/SpotLightHelper.js

@@ -11,7 +11,7 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
 import { Float32BufferAttribute } from '../core/BufferAttribute.js';
 import { BufferGeometry } from '../core/BufferGeometry.js';
 
-var _vector = new Vector3();
+const _vector = new Vector3();
 
 function SpotLightHelper( light, color ) {
 
@@ -25,9 +25,9 @@ function SpotLightHelper( light, color ) {
 
 	this.color = color;
 
-	var geometry = new BufferGeometry();
+	const geometry = new BufferGeometry();
 
-	var positions = [
+	const positions = [
 		0, 0, 0, 	0, 0, 1,
 		0, 0, 0, 	1, 0, 1,
 		0, 0, 0,	- 1, 0, 1,
@@ -35,10 +35,10 @@ function SpotLightHelper( light, color ) {
 		0, 0, 0, 	0, - 1, 1
 	];
 
-	for ( var i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {
+	for ( let i = 0, j = 1, l = 32; i < l; i ++, j ++ ) {
 
-		var p1 = ( i / l ) * Math.PI * 2;
-		var p2 = ( j / l ) * Math.PI * 2;
+		const p1 = ( i / l ) * Math.PI * 2;
+		const p2 = ( j / l ) * Math.PI * 2;
 
 		positions.push(
 			Math.cos( p1 ), Math.sin( p1 ), 1,
@@ -49,7 +49,7 @@ function SpotLightHelper( light, color ) {
 
 	geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
 
-	var material = new LineBasicMaterial( { fog: false, toneMapped: false } );
+	const material = new LineBasicMaterial( { fog: false, toneMapped: false } );
 
 	this.cone = new LineSegments( geometry, material );
 	this.add( this.cone );
@@ -72,8 +72,8 @@ SpotLightHelper.prototype.update = function () {
 
 	this.light.updateMatrixWorld();
 
-	var coneLength = this.light.distance ? this.light.distance : 1000;
-	var coneWidth = coneLength * Math.tan( this.light.angle );
+	const coneLength = this.light.distance ? this.light.distance : 1000;
+	const coneWidth = coneLength * Math.tan( this.light.angle );
 
 	this.cone.scale.set( coneWidth, coneWidth, coneLength );