The equation you mentioned, dividing energy in joules by wavelength in nanometers, does result in units of joules per nanometer. However, it is important to note that the logic behind this equation does not align with de Broglie's equation, which relates the wavelength of a particle to its momentum, not to its energy.
De Broglie's equation, also known as the de Broglie wavelength, is given by λ = h / p, where λ represents the wavelength, h is the Planck constant (approximately 6.626 x 10^-34 joule-seconds), and p is the momentum of the particle. It relates the wave-like properties of particles, such as electrons or other elementary particles, to their momentum.
The equation you mentioned, dividing energy by wavelength, does not have a direct connection to de Broglie's equation or the wave-particle duality of matter. It is important to use equations and concepts that are appropriate for the specific phenomena you are dealing with. In the context of electromagnetic radiation, such as light, the energy of a photon is indeed related to its wavelength through the equation E = hc / λ, where E is the energy, h is the Planck constant, c is the speed of light, and λ is the wavelength. However, this equation applies specifically to photons, not to particles with mass like those described by de Broglie's equation.