Unleashing Yarn's Power: Expanding Dependencies!

Report a typo

Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!

Write a function that takes a package.json object and a dependency name, and returns the version of that dependency. If the dependency is not found, return null. The type of dependency can either be:

  • dependencies

  • devDependencies

  • peerDependencies

Sample Input 1:

Sample Output 1:

true
Write a program in JavaScript
function getDependencyVersion(packageJson, dependencyName) {
// Enter code here





return null
}

Create a free account to access the full topic