O'Reilly logo

Learning Object-Oriented Programming by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required