Refactoring existing code in JavaScript

The following code shows an example of the declaration of the function that renders a sphere named renderSphere and the function that renders a cube named renderCube in JavaScript:

function renderSphere( x, y, z, radius, cameraX, cameraY, cameraZ, cameraDirectionX, cameraDirectionY, cameraDirectionZ, cameraVectorX, cameraVectorY, cameraVvectorZ, cameraPerspectiveFieldOfView, cameraNearClippingPlane, cameraFarClippingPlane, directionalLightX, directionalLightY, directionalLightZ, directionalLightColor) { } function renderCube( x, y, z, edgeLength, cameraX, cameraY, cameraZ, cameraDirectionX, cameraDirectionY, cameraDirectionZ, cameraVectorX, cameraVectorY, cameraVvectorZ, cameraPerspectiveFieldOfView, cameraNearClippingPlane, ...

Get Learning Object-Oriented Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.