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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.